validValue=sscanf(stdin,"%f",&price);
This doesn't work, since sscanf() uses what's in the buffer (stdin in this case), AT THAT MOMENT.
Which is nothing.
Stick with the good combo:
Type: Posts; User: Adak
validValue=sscanf(stdin,"%f",&price);
This doesn't work, since sscanf() uses what's in the buffer (stdin in this case), AT THAT MOMENT.
Which is nothing.
Stick with the good combo:
No, fgets() is good - it never leaves a mess behind on the input buffer -- as long as the char array it's feeding into, has enough room for the newline char, and the end of string char.
scanf() is...
Yes, sscanf() and fgets make a lovely couple dancing together. :D
1) fflush(stdin) doesn't work, for the same reason flushing your kitchen faucet won't work - it's not the toilet, and is an input stream, not an output stream.
2) I don't see anything wrong with...