In a calendar program I am supposed to be able to move ahead and move back months by using the right and left arrow keys and exit the program by using ESC (which I know is '27'), what are the arrow keys?
i've used this code to get some ASCII values but I don't think it gives me the correct ones for the arrows because they are both the same when I do it.
Code:
#include <stdio.h>
#include <conio.h>
#define ESC 27
int main (void)
{
unsigned char ch;
printf("press a key to test\n");
while (ch != ESC)
{
ch = getch();
if (ch == 0 || ch == 225)
{
printf("%d\n", ch);
ch = getch();
}
printf("%c\t%d\t\n", ch, ch);
}
return 0;
}
either telling the codes for the keys or help with the code would be appreciated...