Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!amd!markg From: markg@amd.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: How do you flush the PC's keyboard? Message-ID: <4071@amd.UUCP> Date: Wed, 3-Jun-87 14:25:41 EDT Article-I.D.: amd.4071 Posted: Wed Jun 3 14:25:41 1987 Date-Received: Sat, 6-Jun-87 02:23:58 EDT References: <747@thumper.UUCP> <3320019@hpsrlc.HP.COM> Reply-To: markg@amd.UUCP (Mark Gorlinsky) Organization: Advanced Micro Devices Lines: 28 In article <3320019@hpsrlc.HP.COM> darrylo@hpsrlc.HP.COM (Darryl Okahata) writes: >In comp.sys.ibm.pc, tr@thumper.UUCP writes: >> > 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 */ > The shortest way (from the view point of your own program) is to use DOS Function 0Ch with AL=0. This function will clear the entire keyboard buffer and only requires two lines of assembly or one line of C code. examples: (assembly) mov ax,0C00h int 21h (C) bdos(0x0C, 0, 0); (Turbo C, MSC,or Lattice) -- Mark Gorlinsky - AMD Processor Products Division/APPS SQA UUCP: {decwrl,ihnp4,allegra}!amd!markg AT&T: (408) 982-7811 DISCLAIMER: My opinions are mine, not my employers.