www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/01/08:05:58

Date: Wed, 1 Aug 2001 11:55:41 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Gwen <mb11363 AT chello DOT be>
cc: djgpp AT delorie DOT com
Subject: Re: question about getkey() , time() and how to pick a char from the screen
In-Reply-To: <01c11a27$b0e92280$108784d5@feta>
Message-ID: <Pine.SUN.3.91.1010801115515.14932L@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, 1 Aug 2001, Gwen wrote:

> I tried with some code :
> 
> unsigned key;
>   while (true) {
>     key=bioskey(0);
>     if (key!=0) {      
>       putch(key);
>     }
>   }
> 
> I press 'p', it does nothing

I cannot reproduce this: your program works for me (after I fill in
some missing stuff to make it compile).

> idem for command=10 and command=11,

Note that that's 10 and 11 in hex, not in decimal.

> With command=1, it loops forever displaying a lot of 'p', that's normal,
> but if I press an other key, it will keep displaying the first key pressed,
> why ? 

Because it doesn't remove the key from the keyboard queue, as
documented in the library reference.

> Is there some predefined constant (like keys.h) to use with bioskey() ?

bioskey is a direct interface to the BIOS functions, so it returns the
scan code and the ASCII character as the BIOS returns them.  You can
use keys.h for keys without Ctrl/Alt/Shift modifiers.

- Raw text -


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