Quote Originally Posted by Elysia View Post
Don't flush stdin!
http://cpwiki.sourceforge.net/Common...kes_and_errors


You don't enter EOF. EOF is returned if there was an error. For example, if the user entered "Hi there!" instead of 1.
Actually, according to the specs, EOF is returned "If the first attempt to read a character returns EOF" (or end of string in the case of sscanf). This means that EOF will only happen if:
1. input is coming from a text-file (and the program tries to read something when there's nothing left in the file).
2. the user types CTRL-Z (or CTRL-D in a Unix/Linux environment).

If nothing could be read in, then it will return 0. For example when a number is requested and "blah" is given. [That is for decimal numbers, hex numbers would accept "b" as input, and lah would be left in the buffer].

--
Mats