Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pacbell!sactoh0!bkbarret From: bkbarret@sactoh0.UUCP (Brent K. Barrett) Newsgroups: comp.lang.c Subject: Re: 4.3 curses - how to discard "premature" input? Summary: Flush the input buffer Message-ID: <697@sactoh0.UUCP> Date: 17 Feb 89 20:55:40 GMT References: <15336@oberon.USC.EDU> Distribution: usa Organization: Sacramento Public Access, Ca. USA Lines: 18 In article <15336@oberon.USC.EDU>, xwu@pollux.usc.edu (Xinhua Wu) writes: > For the following program, how can I discard any premature input typed in > before the "Press any character: " prompt appears? {gobble, gobble} > inadvertently type something (or hit a return) which should be discarded. > > Thanks in advance for any help/comments. Have you tried flushing the input buffer? Under MSDOS, it would be something like fflush(stdin); to remove unwanted characters in the input buffer. If this was placed right before the getch() call, or where ever you wanted to dump excess input, the characters in the input buffer would be removed. -- "Somebody help me! I'm trapped in this computer!" Brent Barrett ..pacbell!sactoh0!bkbarret GEMAIL: B.K.BARRETT