The documentation for _getch() is very clear:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getch-getwch?view=msvc-160
"None of these functions can be used to read CTRL+C"
However this does not seem to be true in the most trivial case.
#include <iostream>
#include <conio.h>
#include <windows.h>
int main()
{
std::cout << "x to exit\n";
while (true) {
int c = _getch();
std::cout << "KB " << c << '\n';
if (c == 'x')
return 0;
}
return 0;
}
Run this program and it writes "KB 3" for Ctrl-C.
If I don't call _getch() then Ctrl-C is handled as expected.
