Article View: alt.msdos.programmer
Article #162Re: How to test for key ALREADY pressed
From: Andrew Wang
Date: Thu, 16 Apr 1992 00:42
Date: Thu, 16 Apr 1992 00:42
29 lines
1640 bytes
1640 bytes
weather@sp90.csrd.uiuc.edu (Stephen A. Weatherford) writes: >kentiler@matt.ksu.ksu.edu (Kent Iler) writes: > >>Hello, >> Is there a way to test to see if a key is already pressed. Let say I run >>this program from the autoexec, and I want to see if the space bar is pressed. >>If it is I want to do one thing, if not I want to do another. I don't want to >>wait there for a key to be pressed, just see if it already is. I have C++ and >>Turbo Pascal to program with. Thanks. >> --Kent >Check out kbhit() and ungetch() [I think this last one exists] in your >TC++ manual. >--Stephen >---- >Stephen A. Weatherford (weather@csrd.uiuc.edu) "mann, wer haette das gedacht >G.R.A., Center for Supercomputing R&D dass es einmal soweit kommt >U of Illinois at Urbana-Champaign wegen 99 luftballons" I only have QuickC info with me right now, but you can also try (if it exists in TurboC in some form) "_bios_keybd(int param)" where "param" is a code specifying if you'd like to check the keyboard, or read from it, or something else. kbhit() does work well for most cases though. Andrew
Technical Details
Message-ID:
<siih6INNg1@agate.berkeley.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!crown.berkeley.edu!andywangReferences:
<rqkdmINNkhe@matt.ksu.ksu.edu> <1992Apr8.223837.28390@csrd.uiuc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!crown.berkeley.edu!andywang From: andywang@crown.berkeley.edu (Andrew Wang) Newsgroups: alt.msdos.programmer Subject: Re: How to test for key ALREADY pressed Message-ID: <siih6INNg1@agate.berkeley.edu> Date: 16 Apr 92 00:42:14 GMT Article-I.D.: agate.siih6INNg1 References: <rqkdmINNkhe@matt.ksu.ksu.edu> <1992Apr8.223837.28390@csrd.uiuc.edu> Organization: University of California, Berkeley Lines: 29 NNTP-Posting-Host: crown.berkeley.edu