Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!pasteur!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: how do I clear stdin buffer Message-ID: <14390@dog.ee.lbl.gov> Date: 18 Jun 91 06:44:19 GMT References: <43310@cup.portal.com> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 16 X-Local-Date: Mon, 17 Jun 91 23:44:19 PDT In article <43310@cup.portal.com> tms@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@ee.lbl.gov