-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nico Heinze wrote:
> --- In [email protected], 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
> 
> 

ncurses has some good input routines, but they're non-standard also.
fgets is best all rounder.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHRvC74dyr7s6PRYgRAmpMAJ9/B0vv8ONkcWwV+VLWwusXJ3OMzQCgmHm0
ZUdhNSghzWuCyx/e6MW0e/M=
=/Ys3
-----END PGP SIGNATURE-----

Reply via email to