The thread is not old to me, the problem still exists.
Thank you for the code you posted, but it doesn't work either.
"ReadFile(stdin)" will not return anything until the output buffer is full.
"FlushFileBuffers(stdin)" will not change anything about this behaviour.
And your code contains a small error: "while(c[0])" will generate an endless loop, since c[0] will contain the last char which was read, which won't be "0" (false condition) when reaching EndOfFile or closing the handle.
@redbull:
While CloseHandle(stdout) might work, it would close the handle, making any further output impossible. "prog1.exe" is also running at higher privileges than "tee.exe", so even if I wanted to close the handle, I wouldn't have permission to do so.