installed pty
[VSoRC/.git] / node_modules / node-pty / deps / winpty / misc / GetCh.cc
diff --git a/node_modules/node-pty/deps/winpty/misc/GetCh.cc b/node_modules/node-pty/deps/winpty/misc/GetCh.cc
new file mode 100644 (file)
index 0000000..cd6ed19
--- /dev/null
@@ -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;
+}