Date: Wed, 7 Jul 1999 15:59:09 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Chih Hui cc: djgpp AT delorie DOT com Subject: Re: Flushing input stream? In-Reply-To: <37819F79.72629349@singmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Tue, 6 Jul 1999, Chih Hui wrote: > Hi, how do I flush the standard input stream in DJGPP? In other > compilers, I could use the non-standard way by using fflush(stdin). It depends on what level do you want to empty the input. Borland's fflush(stdin) only empties the characters buffered in the stdin FILE object. This effect can be achieved by calling fseek, like this: fseek (stdin, -66000, SEEK_CUR); (The magic number 66000 is meant to be larger than any possible size of the so-called transfer buffer used by a DJGPP program to pass data to and from real-mode services.) Note that the above doesn't empty the keyboard buffer; if you need that, use BIOS functions like `kbdhit'.