Win32 api for Process.BeginOutputReadLine

I wanted to know the C ++ C # equivalent of Process.BeginOutputReadLine where I read asynchronously from the standard output of another process. Is there an API for this?

0


a source to share


1 answer


To read the standard output of a process, you need to assign an appropriate handle to the instance STARTUPINFO

passed in CreateProcess

. Don't forget to include the flag STARTF_USESTDHANDLES

.

Typically, an anonymous channel created with CreatePipe

.



See " Creating a Child Process with Redirected I / O " for an example.

You can use the usual Win32 approaches (OVERLAPPED + event, IOCompleteion Port, ...) to read the output descriptor asynchronously.

+1


a source







All Articles