Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!sm.unisys.com!oberon!pollux.usc.edu!xwu From: xwu@pollux.usc.edu (Xinhua Wu) Newsgroups: comp.lang.c Subject: 4.3 curses - how to discard "premature" input? Message-ID: <15336@oberon.USC.EDU> Date: 13 Feb 89 23:56:13 GMT Sender: news@oberon.USC.EDU Reply-To: xwu@pollux.usc.edu () Distribution: usa Organization: University of Southern California, Los Angeles, CA Lines: 31 For the following program, how can I discard any premature input typed in before the "Press any character: " prompt appears? ------------ #include main() { int ch; initscr(); crmode(); addstr("Press any character: "); sleep(3); refresh(); ch = getch(); printw("\n\n\nThe character entered was a '%c'.\n", ch); refresh(); endwin(); } ------------- "sleep(3)" is added just to illustrate the point. In practice, one often has to wait for a menu to come up, etc. But during the waiting one might inadvertently type something (or hit a return) which should be discarded. Thanks in advance for any help/comments. ------ Xinhua Wu xwu@cse.usc.edu