I want to ask something about the keyboard input in Borland C++ v3.0. I wanted to ask how u get the input for arrowkeys..
i-e what is their ascii values..?
I want to ask something about the keyboard input in Borland C++ v3.0. I wanted to ask how u get the input for arrowkeys..
i-e what is their ascii values..?
the arrow keys return a scan code that is hardware dependant, also they are extended bit encoded - the first digit they return is a zero and then they return the scan code. To find out what code they return on your system write a key detector that gets the key loops back after a zero and prints the integer value.
int check_key(); //begin checking function
{
int keypress; //holds the scan code of the keypress
keypress=getch();//get the keypress
if (keypress==0){check_key();}//check for extended key
else
cout<<keypress//print the scan code
int wait = getch();//wait for a keypress
}//end function
call this from main,
hope this helps
Last edited by iain; 01-13-2002 at 05:03 PM.
Monday - what a way to spend a seventh of your life
do I have to include a special library class function header thingy? I try it in dev-c++4, and i get implicit declaration of getch()
AOL: GrNxxDaY
IDE: Dev-C++ Beta 5 (v4.9.4.1)
Project: Eye of Sahjz (text-RPG)
If you think I may need help, please IM me.
#include <mingw_conio.h> if conio.h doesn't work