input problem

Pages: 12
The arrows act like special keys and they first returns 224 and the second time 75(or what code each one has)...
You can't really understand it there because the loop just ignores the 224 and reads the 75 without prompting for it...
if you write a program like:
1
2
3
4
5
int main(){
   char ch;
   ch = _getch();
   cout << (int)ch;
}

and you press an arrow then you will just see number 224...

The special characters return two bytes. The first one is 0 for the F-keys and 224 for other keys... It is easy to make a condition and check if the return from the getch() is 0 so you can make another call to get the second code as well. But since 224 is part of the ascii code and contains a letter (at least in my language it is the letter 'ω' ) you can't just ignore it.
Last edited on
oohhhh alright, thanks for correcting me
Is there even a key for omega?
yeap...
If you install in your computer the greek alphabet, as a keyboard language, and you press the letter 'v' you will see the letter omega Ω, ω...
Last edited on
Topic archived. No new replies allowed.
Pages: 12