About pipe stdio and redirect

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In msdn library, there is an example about "Creating a Child Process with
Redirected Input and Output".
now in my case, the child process whill use "printf" to write to its
stdout which is redirected to my pipe. but as you know, the "printf" is
buffered, so the problem is that the parent's "FeadFile" can not return when
the child has already use "printf" to write something. (!!!Note that the
child process is a third party application,I can't modify it, and the child
and parent are interactive, I must know what child had written in each step,
and I can't close the handle).
How can I solve this problem? Thank you very much.
 
binaryboy said:
In msdn library, there is an example about "Creating a Child Process with
Redirected Input and Output".
now in my case, the child process whill use "printf" to write to its
stdout which is redirected to my pipe. but as you know, the "printf" is
buffered, so the problem is that the parent's "FeadFile" can not return when
the child has already use "printf" to write something. (!!!Note that the
child process is a third party application,I can't modify it, and the child
and parent are interactive, I must know what child had written in each step,
and I can't close the handle).
How can I solve this problem? Thank you very much.

Unless you can tell the child process to unbuffer stdout or flush after
every write, there's nothing you can do. I don't know of any hidden way to
get a VC program to do these things.
 
Back
Top