How can I capture output of a console app in a loop

Viewed 36

My program runs a console program and captures the output using these functions:

CreatePipe, CreateProcess, WaitForSingleObject, ReadFile, and CloseHandle.

My program works great and displays the output in a window control.

If I am going to run a console app that will take a long time, instead of calling WaitForSingleObject, I'd like to call ReadFile within a loop and have the loop end when the console app does and the last message has been read.

All my attempts at this result in a forever loop and I have to kill the main program. Any advice would be appreciated. Thanks!

0 Answers
Related