Hey wassup? I need to know how to detect arrow keysand the escape key, and any help would be greatly appreciated, thanks!
CodeBoy101
-2
Junior Poster in Training
Recommended Answers
Jump to PostIf you are writing a console program then see these console functions. Not immediately sure which one(s) you need to use. You might also look through some of these links
Jump to PostYou can also use the functions from conio.h, kbhit() and getch(). up/down/left/right return 2 codes, while esc return 1 code.
if(kbhit()){ int ch = 0 | getch(); if(ch == 0xe0 && kbhit()){ // extended character (0xe0, xxx) ch = (ch<<8) | getch(); // get extended xharaxter info …
Jump to PostWhy don't you try running the program and pressing the enter key. The program will display the code for the key. Then you can put the key code as a case in the switch() just like what has been done for the other keys. This way you can find out …
All 9 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
dougy83
74
Posting Whiz in Training
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
dougy83
74
Posting Whiz in Training
CodeBoy101
-2
Junior Poster in Training
dougy83
74
Posting Whiz in Training
CodeBoy101
-2
Junior Poster in Training
dougy83
74
Posting Whiz in Training
CodeBoy101
commented:
Very helpful, this guy is a reason to be on Daniweb!
+1
CodeBoy101
-2
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.