I wrote a small program that
tries to get the ASCII key codes for
every key we press until we press Esc.
It is working fine all the time except when
we press certain keys (example: arrow keys)
It is printing an extra zero before printing
the actual values (which are correct)
why am i getting this zero ?
here's the code:
PHP Code:
#include <stdio.h>
#include <conio.h>
main()
{
char c;
printf("KEY\tCODE\n");
while ((c = getch()) != 27)
{
printf("%3c\t%4d\n", c, (int)c);
fflush(stdin);
}
}