delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/31/21:15:12

From: "Gwen" <mb11363 AT chello DOT be>
Subject: Re: question about getkey() , time() and how to pick a char from the screen
Newsgroups: comp.os.msdos.djgpp
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010731114717 DOT 1042K-100000 AT is>
Message-ID: <01c11a27$b0e92280$108784d5@feta>
X-Newsreader: Microsoft Internet News 4.70.1162
Lines: 45
Date: Wed, 01 Aug 2001 01:09:20 GMT
NNTP-Posting-Host: 213.132.135.16
X-Complaints-To: abuse AT chello DOT be
X-Trace: news.chello.be 996628160 213.132.135.16 (Wed, 01 Aug 2001 03:09:20 MET DST)
NNTP-Posting-Date: Wed, 01 Aug 2001 03:09:20 MET DST
Organization: Chello Usenet Service
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote in article
<Pine DOT SUN DOT 3 DOT 91 DOT 1010731114717 DOT 1042K-100000 AT is>...
> 
> You could use `bioskey' with 1 as the command.

I'm experiencing some problems with bioskey() 
excerpt from a help-file about it :

" COMMAND = 0
     Returns the next key pressed.  The value returned is a combination
     of the key's scan code in the high 8 bits and its ASCII code in
     the low 8 bits.

COMMAND = 1
     Checks the keyboard, returns zero if no key pressed, else the key.
     Does not dequeue the key from the keyboard buffer.  The value
     returned when a key was pressed is a combination of the key's scan
     code in the high 8 bits and its ASCII code in the low 8 bits. "

(and command = 10 is command = 0 for extended 101 keyboard, idem command =
11 is command = 1)

I tried with some code :

unsigned key;
  while (true) {
    key=bioskey(0);
    if (key!=0) {      
      putch(key);
    }
  }

I press 'p', it does nothing, idem for command=10 and command=11,
strange...
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 ? 

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

Gwen
     

- Raw text -


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