Debian Codegraph @

deps/winpty/misc/Win32Echo1.cc

raw
1 /*
2 * A Win32 program that reads raw console input with ReadFile and echos
3 * it to stdout.
4 */
5
6 #include <stdio.h>
7 #include <conio.h>
8 #include <windows.h>
9
10 int main()
11 {
12 int count = 0;
13 HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
14 HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
15 SetConsoleMode(hStdIn, 0);
16
17 while (true) {
18 DWORD actual;
19 char ch;
20 ReadFile(hStdIn, &ch, 1, &actual, NULL);
21 printf("%02x ", ch);
22 if (++count == 50)
23 break;
24 }
25 return 0;
26 }