Specific Keys in C, getting and putting
Hey everyone how yall doin', i've got a programming problem in C, probably easily cured, but I can't say for sure.
Alright how do you flag down individual keys on a keyboard, getchar() just don't cut it, for 2 reasons:
1. I don't like the post enter delimma (Yes i've read the Eskimo guy's note)
2. It's only for ASCII and that doesn't cover ALL keys
So really my question is, what function can I use to get the SPECIFIC character that a user presses
Code:
ex.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Press a key: ");
int key=getchar();
printf("You pressed %d\n",key);
system("PAUSE");
return 0;
}
I don't care if it returns a number or character, I just want a function, and probably not getchar(), to return the specific value of whatever key was pressed, and even diffrenciate between regular 1 and num pad 1, as well as include all other "standard" 102 key keyboard keys like "del", "sys rq" or "arrow up".
Thanks so much for taking the time to read this and for the time of your reply, it really means alot.
Problem solved, but with confusion
I got and working thanks to the link to here, however, although it solved my problem there was something there I didn't understand, the 0xE0, what significance does that play? I understand 256's role, since extended characters that aren't ASCII have null ASCII code you need more than the first byte of scan code. Even after reading msdn's reference and goldenrock's ASCII key code link I still don't understand the 0xE0 (and yes i'm aware that's 224 in decimal) I still don't understand it.
Thanks so much everyone,
Alex
Re: Problem solved, but with confusion
Quote:
Originally posted by Axpen
I got and working thanks to the link to here, however, although it solved my problem there was something there I didn't understand, the 0xE0, what significance does that play? I understand 256's role, since extended characters that aren't ASCII have null ASCII code you need more than the first byte of scan code. Even after reading msdn's reference and goldenrock's ASCII key code link I still don't understand the 0xE0 (and yes i'm aware that's 224 in decimal) I still don't understand it.
Thanks so much everyone,
Alex
All function keys are not combined with 0x00. The first byte of some are 0xE0.