Click to See Complete Forum and Search --> : Capture console output in real-time. Help!


intermario_gr
June 30th, 2007, 10:51 PM
Hello

I am building a Windows application that, at some point, calls a separate process (a command line application). The latter takes quite some time to complete (about 5 minutes or more). How can I capture the console app's output in order to show it (in a textbox for instance) in my windows application?

Please note that I don't want the console app's whole output after it's completed. I want to capture its console output while it's producing it.

Thanks.

dglienna
June 30th, 2007, 11:41 PM
You can use the old DOS > text.txt to send output to a file.
It's called the pipe character. >> appends, while > creates.

creatorul
July 1st, 2007, 12:37 AM
See if Process.StandardOutput helps you:
http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx

Shuja Ali
July 1st, 2007, 04:53 AM
Take a look at BeginOutputReadLine Method (http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.beginoutputreadline.aspx) of the process class.

intermario_gr
July 1st, 2007, 08:53 AM
See if Process.StandardOutput helps you:
http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx

Take a look at BeginOutputReadLine Method (http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.beginoutputreadline.aspx) of the process class.

Thanks guys, I haven't tried it yet but I'm pretty sure this is what I've been looking for. You were of great help.