Add a test program that dumps console input via _getch.

This commit is contained in:
Ryan Prichard 2017-01-31 22:03:52 -06:00
parent 84016539f3
commit bf98ff3c20

20
misc/GetCh.cc Executable file
View File

@ -0,0 +1,20 @@
#include <conio.h>
#include <ctype.h>
#include <stdio.h>
int main() {
printf("\nPress any keys -- Ctrl-D exits\n\n");
while (true) {
const int ch = getch();
printf("0x%x", ch);
if (isgraph(ch)) {
printf(" '%c'", ch);
}
printf("\n");
if (ch == 0x4) { // Ctrl-D
break;
}
}
return 0;
}