Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!hellgate.utah.edu!helios.ee.lbl.gov!ucsd!ucsdhub!hp-sdd!hp-pcd!hpcvia!brianh From: brianh@hpcvia.CV.HP.COM (brian_helterline) Newsgroups: comp.lang.c Subject: Re: hitkb exists? Message-ID: <18060011@hpcvia.CV.HP.COM> Date: 5 Feb 90 16:55:29 GMT References: Organization: Hewlett-Packard Co., Corvallis, Oregon Lines: 34 ron@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, ....