Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!hplabs!hpcea!hpsrla!hpsrlc!darrylo From: darrylo@hpsrlc.HP.COM (Darryl Okahata) Newsgroups: comp.sys.ibm.pc Subject: Re: How do you flush the PC's keyboard? Message-ID: <3320019@hpsrlc.HP.COM> Date: Tue, 2-Jun-87 10:52:55 EDT Article-I.D.: hpsrlc.3320019 Posted: Tue Jun 2 10:52:55 1987 Date-Received: Sat, 6-Jun-87 12:57:06 EDT References: <747@thumper.UUCP> Organization: Network Measurements Div - Santa Rosa, CA Lines: 44 In comp.sys.ibm.pc, tr@thumper.UUCP writes: > >According to _Advanced MS-DOS_ by Ray Duncan, DOS function C (hex) >resets the input buffer and then gets a character for input using one >of five DOS functions. They are 1, 6, 7, 8, and A (hex). I want to >flush the keyboard without getting input. The reason for this is that >the next thing my program does is call up a canned function that uses >keyboard input. > >I am using Lattice C. Is there a standard way of doing this with C or >Assembler? I would not expect > > fflush(stdin); > >to work because fflush is said to be for output buffers. > >Thank you for your attention. You people are great. > >-- >Tom Reingold >INTERNET: tr@bellcore.bellcore.com >UUCP: {seismo,ihnp4,ucbvax,decvax}!bellcore!tr > {ulysses,allegra,clyde,princeton}!bellcore!tr >---------- With assembler, you use two DOS functions (I don't remember the function numbers): one which checks to see if a keyboard character is available, and another to read a keyboard character. From here, it's simple (given in C pseudocode): while (character_available()) read_character(); /* throw read characters into the bit bucket */ I don't know of any *standard* way to do this. -- Darryl Okahata ucbvax!ucbcad!ames!hplabs!hpcea!hpsrla!darrylo <== best path hplabs!hpcea!hpsrla!darrylo <== alternative CompuServe: 75206,3074 Disclaimer: the above is the author's personal opinion and is not the opinion or policy of his employer or of the little green men that have been following him all day.