#include <conio.h>
int main (void)
{
for (;;)
{
unsigned char ch = getch();
printf ("0x%02X\n", ch);
}
}
I want to get the scan code.
Here is the description from Wikipedia:
Reads a character directly from the console without buffer, and without echo.
When I pressed Del, it shows 0xE0 0x53.
When I pressed Ctrl+PgUp, it shows 0xE0 0x86.
Though some are the same as the table, most of the values it shows are different from it.
So, does getch()
really get scan codes?
Here is the scan code table (set 2, most commonly used)