🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
3 messages
3 total messages Started by Kent Iler Mon, 06 Apr 1992 22:47
How to test for key ALREADY pressed
#125
Author: Kent Iler
Date: Mon, 06 Apr 1992 22:47
8 lines
756 bytes
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
Re: How to test for key ALREADY pressed
#138
Author: Stephen A. Weatherford
Date: Wed, 08 Apr 1992 22:38
19 lines
1268 bytes
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"
Re: How to test for key ALREADY pressed
#162
Author: Andrew Wang
Date: Thu, 16 Apr 1992 00:42
29 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads