I expect ReadConsoleW()
to return after reading a specific number of bytes.
But it doesn't return.
How can I make ReadConsoleW()
return as soon as it finished reading the number of bytes specified?
The code I tried is here:
#include <stdio.h>
#include <Windows.h>
int main()
{
//something is being written to stdin.
Sleep(2000);
int b;
int r;
//read 3 wide character
ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), &b, 3*sizeof(TCHAR), (LPDWORD)&r, NULL);
//problem: no returns until enter pressed
putc(b,stdout);
while(1)
{};
}