hi, i wanted to know the c++ equivalent of c#'s Process.BeginOutputReadLine, where i aynchronously read from the standardoutput of another process. Is there any API for it?
+1
A:
To read the standard output of a process you need to assign an appropriate handle to an instance of STARTUPINFO
passed to CreateProcess
. Remember to include the STARTF_USESTDHANDLES
flag.
Usually an anonymous pipe is used, created via CreatePipe
.
See "Creating a Child Process with Redirected Input and Output" for an example.
You can use the normal Win32 approaches (OVERLAPPED + event, IOCompleteion Port,...) to reading the output handle asynchronously.
Richard
2009-05-12 10:47:37