Mail Archives: djgpp/2003/08/12/11:13:19
Hans-Bernhard Broeker wrote:
Sterten <sterten AT aol DOT com> wrote:
>
>> I'm afraid not. getkey and getxkey interrupt the program and wait
>> until the user presses a key.
>
>You didn't really look into the docs, did you? You should have found
>about the capability of bioskey() to just see if a key was already
>pressed if you did.
<
>Or you would have found the kbhit() function.
I went to the /info directory, put everything there in one big
file and searched this file for keywords.
No referrence to kbhit from any of the 4 other mentioned functions.
No mention of kbhit in the FAQ , BTW.
>> If e.g. someone presses <blank> and 5 minutes later <esc> ,
>> then <esc> won't be recognized by bioskey.
>
>So what? Did it really not occur to you that you can't have it both
>ways --- being informed about new keypresses, but still ignoring keys
>pressed a while ago?
The program below seems to do exactly that :
>Your assembly snippet would map quite exactly to this, in C:
>
> if (kbhit()) {
> getkey();
> /* do something with the key */
> }
exactly ! Thanks.
Very useful, frequently needed routine IMO.
Guenter
- Raw text -