If i'm scanning from keyboard using getch(), how do i check which arrow key has the user pressed??(Arrow keys have ASCII values same as some other keys so we can't directly check for ASCII values)
mail2shrid
0
Newbie Poster
Recommended Answers
Jump to PostThat would depend on your operating system and compiler.
So which do you have?
Try to be more specific than "windows" and "borland", as there are many versions of each.
Jump to PostTry this simplest program, look at these codes on your screen:
#include <stdio.h" #include <conio.h> /* Press Esc to quit */ #define ESC 27 int main() { int ch; while ((ch=getch()) != ESC) { printf("%d",ch); while (kbhit()) { printf(" %d",getch()); } printf("\n"); } printf("ESC %d\n",ch); return 0; …
Jump to PostI'm using DOS and the compiler is turboc..
This program only works in Turbo C.
#include <stdio.h> #include <conio.h> int main(void) { unsigned char key, key2; while( (key=getch()) != '\r' ) { if (key == 0) { key2 = getch(); switch(key2) { case 72: printf("up "); break; …
Jump to PostLook at this wonderful table:
http://www.jimprice.com/jim-asc.shtml#keycodes
Google is your friend ;)...
All 14 Replies
Salem
5,138
Posting Sage
mail2shrid
0
Newbie Poster
ArkM
1,090
Postaholic
Colin Mac
53
Posting Whiz
ArkM
1,090
Postaholic
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
ArkM
1,090
Postaholic
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
ArkM
1,090
Postaholic
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
ArkM
1,090
Postaholic
Takari1994
-4
Newbie Poster
WaltP
commented:
resurrecting for no new information
-4
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
ashok1514
-4
Newbie Poster
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.