Win32 ReadFile hangs when reading from pipe

前端 未结 3 840
慢半拍i
慢半拍i 2021-01-05 07:10

I am creating a child process, and reading its output. My code works fine when the child process creates output (cmd /c echo Hello World), however ReadFile will

3条回答
  •  佛祖请我去吃肉
    2021-01-05 07:47

    You should close the write end of the output pipe before you read from it, as @Marcus suggested in the comment.

    CloseHandle(g_hChildStd_OUT_Wr);

    For me this is the real answer.

提交回复
热议问题