[英]win32 api for Process.BeginOutputReadLine
i wanted to know the c++ equivalent of c#'s Process.BeginOutputReadLine, where i aynchronously read from the standardoutput of another process. 我想知道c#的Process.BeginOutputReadLine的c ++等效项,在这里我从另一个进程的standardoutput中异步读取。 Is there any API for it?
是否有任何API?
To read the standard output of a process you need to assign an appropriate handle to an instance of STARTUPINFO
passed to CreateProcess
. 要读取流程的标准输出,您需要为传递给
CreateProcess
的STARTUPINFO
实例分配适当的句柄。 Remember to include the STARTF_USESTDHANDLES
flag. 记住要包含
STARTF_USESTDHANDLES
标志。
Usually an anonymous pipe is used, created via CreatePipe
. 通常使用通过
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. 您可以使用普通的Win32方法(OVERLAPPED +事件,IOCompleteion端口等)来异步读取输出句柄。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.