I have read two helpful articles about spawning a console application and
using anonymous pipes to provide the standard input and capture the standard
output and standard error.
These articles were:
http://msdn2.microsoft.com/en-us/library/ms682499(VS.85).aspx
http://support.microsoft.com/kb/190351
I really don't use standard input, but when capturing the standard output
and standard error, I used a loop in the parent program like:
stdout_pipe_exhausted = FALSE;
stderr_pipe_exhausted = FALSE;
while (!stdout_pipe_exhausted || !stderr_pipe_exhausted)
{
Use ReadFile(stdout) to get the stdout data, and if no data or pipe
broken stdout_pipe_exhausted = TRUE;
Use ReadFIle(stderr) to get the stderr data, and if no data or pipe
broken stderr_pipe_exhausted = TRUE;
}