scanf bug?
-
Hello, I experienced a strange behaviour from the scanf function; if i put the following code char ch; printf("stuff"); scanf("%c", &ch); the program fills ch automatically and continues (skips input), anyone had the same problem ?
Deian wrote:
the program fills ch automatically and continues (skips input), anyone had the same problem ?
Perhaps there is already something in the stdio stream that is being accepted by
scanf()
.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
Deian wrote:
the program fills ch automatically and continues (skips input), anyone had the same problem ?
Perhaps there is already something in the stdio stream that is being accepted by
scanf()
.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
Hello, I experienced a strange behaviour from the scanf function; if i put the following code char ch; printf("stuff"); scanf("%c", &ch); the program fills ch automatically and continues (skips input), anyone had the same problem ?
It is working perfectly fine in Visual Studio 6.0. Could you please give us some more details about Compiler, Operating System OR any information worth to repeat this problem?
-
It is working perfectly fine in Visual Studio 6.0. Could you please give us some more details about Compiler, Operating System OR any information worth to repeat this problem?
-
Hello, I experienced a strange behaviour from the scanf function; if i put the following code char ch; printf("stuff"); scanf("%c", &ch); the program fills ch automatically and continues (skips input), anyone had the same problem ?
use sscanf Please mail me
-
Visual Studio 6.0 / SP5, Windows XP SP2 g++, FreeBSD 6.1 Devshed C++ / Windows XP SP2 I experience the same behaviour at all OS's and compilers.
I've checked it on RH linux too with gcc compiler. Sorry sir, it's not repeatable. Could you please let me know some more details about the program? One possibility is that, this is the part of your big program and something is already there in stdin stream. Did you check the mentioned code as a separate program?
-
I've checked it on RH linux too with gcc compiler. Sorry sir, it's not repeatable. Could you please let me know some more details about the program? One possibility is that, this is the part of your big program and something is already there in stdin stream. Did you check the mentioned code as a separate program?