delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/05/06:39:53

Date: Tue, 5 Oct 1999 09:54:33 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Roland Moritz <hotel DOT moritz AT utanet DOT at>
cc: djgpp AT delorie DOT com
Subject: Re: How to empty the keyboard buffer
In-Reply-To: <7tajaf$q2a$1@rohrpostix.uta4you.at>
Message-ID: <Pine.SUN.3.91.991005095415.2899L-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 4 Oct 1999, Roland Moritz wrote:

> And now my question is, how do I empty the keyboard buffer everytime the
> loop is through, since I don't want, for example, that if a message is shown
> for 5 Seconds, and the player pushes some keys, that they will be used as
> keyboard input the next time the loop is running through, since there are
> still keys in the buffer...I've tried it with something simple like
> 
> while (kbhit()
>   c = getch();
> 
> But it does'nt work...

The above *is* the way to empty the keyboard.  If it doesn't work for
you, please post the shortest test program that can be compiled and
that demonstrates how does it fail.  Please also tell how do you run
the test program and what do you expect to happen if it did work.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019