From: "A.Appleyard" To: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU Date: Fri, 12 May 1995 14:28:29 BST Subject: flushing the keyboard buffer gilliard AT lectra DOT fr (Laurent Pierre Gilliard) asked:- >How can i empty the keyboard buffer with gcc? (1) tony AT nt DOT tuwien DOT ac DOT at (Anton Helm) replied:- #include while(kbhit()) getkey(); /* unfortunately this is not very portable... */ (2) pascal DOT richard AT art DOT alcatel DOT fr (Pascal RICHARD) replied:- You must use : fflush (stdin); I suspect that (1) flushes the PC's buffer, and (2) flushes djgpp's buffer. These are two distinct buffers. scanf() etc read from buffer (2). When scanf() etc find buffer (2) empty, they call _filbuf() to read from buffer (1) into buffer (2). I think. Some functions such as getkey() read straight from buffer (1), bypassing buffer (2).