hitkb exists?
brian_helterline
brianh at hpcvia.CV.HP.COM
Tue Feb 6 03:55:29 AEST 1990
ron at clarity.Princeton.EDU (Ronald Beekelaar) writes:
>Hi,
> I left out some needed information in my question last night.
>I was wondering whether I can silently test whether a key has been pressed in
>C, without having to read(..). I forgot to tell that I am using MS-C on an
>IBM-PC.
> I would help me enormously, if somebody could tell me how I should do this.
>Thanks,
>--
>------
>ron
>------
>----------
unsigned status;
status = _bios_keybrd( _KEYBRD_READY );
if( status == 0 )
/* no key pressed */
else
/* some key was pressed */
If you are concerned about the SHIFT, CTRL, ALT, SCROLL LOCK,
NUM LOCK, CAPS LOCK, and INSERT use _bios_keybrd( _KEYBRD_SHIFTSTATUS )
with the above.
-------- OR ---------------
You can use the function int kbhit(void) to check if a key has been
pressed but not the SHIFT, CTRL, ALT, ....
More information about the Comp.lang.c
mailing list