I saw the following code on the internet as
DWORD qThreadID;
HANDLE hThread = CreateThread(0, 0, ThreadFn, &uiCounter, 0, &qThreadID);
// Loop until the user enters 'q'
char cChar = ' ';
while (cChar != 'q') {
cout << uiCounter << endl;
cChar = (char)getchar();
}
how does the keypress event “Enter” works on it?
(when i debug it except for the press of “Enter” no other keypress functionality works )
Thanks
getchar()reads from standard in, which is buffered, both in thelibrary and in the OS. The usual OS’s won’t return from a read on a
console device until enter is entered; they support command line
editing, and require the enter key to finalize the input.