triplem
asked on
Pressing keyboard - newbie
I need something which finds out if the keyboard has been hit or not. Basically I want the computer to wait for a while (using a for loop), if so and so key has been pressed do this (which can happen more than once in the loop). However I don't want it to wait until a key has been pressed before continuing.. is there any function like this?
my program is something like:
while (alive)
{
for (i=0; i<1000000; i++)
{
if (x has been pressed)
do this;
}
do this;
}
my program is something like:
while (alive)
{
for (i=0; i<1000000; i++)
{
if (x has been pressed)
do this;
}
do this;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
make use of bioskey() function
e.g. (1)
char x;
read (x);
if (x == '1_char_expected') //or use it value in ascii
{
...
}
e.g. (2)
if (getch ())
{
...
}