tags:

views:

87

answers:

3

I have a console application that I didn't write. Is there some easy way to read from it? I need to have the input still on the console window, but read what's being displayed.

I care not whether the output displays to the console or not, so long as the input still works.

A: 

I had a project that is doing the same thing. I have a console application written in VB.Net and I run and capture it's output using my Delphi application. I have successfully achieved this by following this tutorial by Zarko Gajic.

rajeem_cariazo
The code at that site is identical to the code in Ervins's answer. It doesn't handle console input, and it only reads output after the child terminates.
Rob Kennedy
+2  A: 

Console Application Runner Classes are excellent to control the console application processes and to redirect input and output where required.

SimaWB
This looks promising, i'll check it out. The only problem I've had in the past with using an fstream for the input is that I can't emulate an enter keypress.
Nowayz
A: 

Already answered on Stack overflow.

ErvinS
Not really. Your answer in that question completely ignores Nowayz's requirement that input continue to work. It also stalls the parent application until the child finishes running, which might be never if the child writes more output than the OS buffer can hold.
Rob Kennedy