delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/23/06:01:57

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Wed, 23 Jan 2002 13:00:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: ROLAND <roland_asmann AT yahoo DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: kbhit()
In-Reply-To: <20020123105549.98938.qmail@web9101.mail.yahoo.com>
Message-ID: <Pine.SUN.3.91.1020123125756.7779A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 23 Jan 2002, ROLAND wrote:

> --- Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> > Something is wrong with the rest of your code:
> > kbhit() _is_ the function 
> > you are looking for.  It returns immediately,
> > without waiting for a key 
> > to be pressed.
> 
> This is what my code looks like:
> 
> if(kbhit()==0){
>      if(getkey()==3){
>           interrupt();
>      }

That's backwards: if kbhit() returns zero, it means that no key was hit.  
So what this program does is _always_ call getkey() when no key was 
pressed, and getkey() waits for a keypress.

- Raw text -


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