Unfortunately, fflush (stdin) is not part of the standard. Some compilers support it, some don't. Fflush, per the standard, is for output. rewind (stdin), however, will do the job, although it sounds goofy.