[Bug c/10924] New: Entering incorrect information to scanf breaks scanf.
gaffneyc@student.gvsu.edu
gcc-bugzilla@gcc.gnu.org
Thu May 22 04:10:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10924
Summary: Entering incorrect information to scanf breaks scanf.
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: gaffneyc@student.gvsu.edu
CC: gcc-bugs@gcc.gnu.org
When using scanf and you enter an incorrect value ie (scanf("%lf", &var) and
you enter a scanf breaks and each succesive call will simply be passed by.
Some example code:
doube *myVar;
while(!scanf("%d", myVar)) {
puts("Incorrect");
rewind(stdin);
}
Should reask the user for scanf but instead it will continue looping. The
problem is that stdin is not being set to EOF. I tried under the default cygwin
gcc version and gcc 3.2.2 under gentoo linux. Bother give the same result. When
compiled under mingw and visual c compiler it works as expected.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Gcc-bugs
mailing list