4.3 curses - how to discard "premature" input?

Brent K. Barrett bkbarret at sactoh0.UUCP
Sat Feb 18 06:55:40 AEST 1989


In article <15336 at oberon.USC.EDU>, xwu at 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



More information about the Comp.lang.c mailing list