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:
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
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?