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 PostActually, if you need to simply accept input, you don't need
kbhit()
at all:c2 = 0; // reset c2 to 'nothing' c1 = getch(); // wait for a key if (c1 == 0) // check if it's a function key { c2 = getch(); // …
Jump to PostAbout kbhit(): look at my program example ...
I did, and don't see why you need a
kbhit()
for that. A simple test for 0 would work.... then try to print the second byte of a special key without kbhit() at the same line...
Simple without the
kbhit()
. …
Jump to PostYeah, I know. The concept is still correct. As a matter of fact, the first byte for those keys has been 0xE0 long before XP was created.
All 14 Replies
Salem 5,265 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.