-
Keys in console..
Hi.
Just one question.
In a console application, are there any way it can detect keypresses? For example, if someone press the down arrow key and I want something special to happen when it is pressed, do it exist any code like:
case keydown or something?
Sorry for my bad english..
-
1 Attachment(s)
here you, just include the header file if you want the values for the special keys, like f1-f9, and control + key
PHP Code:
#include <stdio.h>
#include <conio.h>
int main(int argc, char* argv[])
{
int i;
i=getch();
printf("%d",i); //print out what key they pressed
if(i==224)
printf("you pressed the up key!\n");
}
they don't have to press enter
hope that helps
-nabeel
-
-