I'm writing a programm that's using getch()
to scan for arrow keys. My code so far is:
switch(getch()) {
case 65: // key up
break;
case 66: // key down
break;
case 67: // key right
break;
case 68: // key left
break;
}
Problem is that when I press 'A'
, 'B'
, 'C'
or 'D'
the code will also executed, because 65
is the decimal code for 'A'
, etc...
Is there a way to check for an arrow key without call others?
Thanks!
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…