In Windows, you can create a child process with redirected I/O using anonymous pipes, as described here: Creating a Child Process with Redirected Input and Output MSDN
But, when Stdout is redirected to a non-interactive device like a pipe, it's automatically set to buffered mode. This creates a devastatingly tangled I/O situation. That is, I don't get Stdout's data, until it's manually flushed, or the program terminates. I think, the only elegant solution to this problem is to disable standard I/O buffering at the creation of the child process.[CreateProcess()]
The question is how can I do it? Any example with codes will be very appreciated. (Note: I've searched the Internet, but I can't even get close to the solution.) Thanks!
EDIT: The actual question is, in win32 API how can I disable standard I/O buffering of a child process before creating it using CreateProcess() ?
EDIT-2: I guess I found a pretty hack for this problem. Stdout only full-buffers when file descriptor is not a 'TTY'(Terminal/Console device), if I can somehow make my Pipe a Pseudo-TTY then the problem would be fixed. So, the question is How can I make/set a pipe as a pseudo-TTY in windows? I cannot find any solution in the Internet.