Date: Sun, 20 Apr 1997 16:51:33 +0300 (IDT) From: Eli Zaretskii To: Flynn cc: djgpp AT delorie DOT com Subject: Re: Clear key buffer In-Reply-To: <5j4rvv$5h2@maia.cc.upv.es> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 17 Apr 1997, Flynn wrote: > I've some problems clearing the key buffer ring. In watcom I used: > > > static short * const KeyBufferFirst=(short * const)0x41a; > static short * const KeyBufferLast=(short * const)0x41c; > > *KeyBufferFirst=*KeyBufferLast; > > but in DJGPP it doesn't work.... Others already have told you why it doesn't work. But I would like to point out that this is just plain wrong: this code will break even in Watcom on systems where keyboard enhancer is installed. Many keyboard enhancers replace the brain-damaged 15-character BIOS keyboard buffer with a larger one, which is of course at different address in memory. Your code will fail miserably in such cases. I suggest to do it the usual way: #include while (kbhit ()) getch (); This clears the keyboard buffer, no matter what TSR has taken over Int 16h. It might be slower, but how many times per second do you need to clear the keyboard buffer, anyway?