how do I clear stdin buffer
Chris Torek
torek at elf.ee.lbl.gov
Tue Jun 18 16:44:19 AEST 1991
In article <43310 at cup.portal.com> tms at cup.portal.com
(Taos Mountain Software) writes:
>The stdio function "scanf" works great for input from datafiles, but I
>always run into problems when doing interactive tty I/O on Unix systems.
Avoid scanf. sscanf() is OK; scanf() is not. There may be exceptions
to this rule, but I have found none yet.
>... what I'm interested in is a function like fflush that deals with
>input streams.
POSIX says that fflush wipes out pending input. 4.4BSD will probably
have fpurge(). Neither is portable to all ANSI C systems.
--
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA Domain: torek at ee.lbl.gov
More information about the Comp.lang.c
mailing list