Hi! I have a small piece of code that checks the number (code) of an inputted character and later, for example, prints something. My idea is for the user to be able to navigate through the display only with the up and down arrows, and now this code:
Code:
do {
c = getch();
}
while (c!=0);
if(c==0)
{
c = getch(); // retrieve second byte of extended code
c *= 256; // shift left by 8 bits to get extended code
printf( "Extended keystroke: %X\n", c );
}
The problem is that it will check if the first byte is 0, however I don't know if it's possible to limit the pressing of buttons like End, Pg Dn, Home, Pg Up etc... ? I can write after this: if (c==0x4800) printf("up"); else if (c==0x5000) printf("down"); Perhaps it's an easy task and I just need some rest before finishing this, but the fact is that at this moment I have no solution. Glad, if you could help.