--- In c-prog@yahoogroups.com, Thomas Hruska <[EMAIL PROTECTED]> wrote: > > Avik wrote: > > clear/flush your standard input buffer before you > > take a an input from standard input device (i.e. > > keyboard). use fflush(stdin) before scanf. e.g. > > > > scanf("%d",& y); > > fflush(stdin); > > > > scanf("%c",& z); > > fflush(stdin) is NON-ANSI Standard behavior. > Besides...the input data could already be in the queue.
That's one of the reasons why I prefer fgets() over any sort of scanf() function; fgets() is safe to use, data type conversions (such as strtol() and the like) are of good use, you don't have to mess around with single keystrokes being stuck in any queue, and finally I don't have to keep in mind whether to insert a blank space in the format specifier or not. Why make life harder than it already is. Regards, Nico