Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to capture a Processes STDOUT and STDERR line by line as they occur, during process operation. (C#)

Tags:

People also ask

How do I redirect stdout of a running process?

The way we can redirect the output is by closing the current file descriptor and then reopening it, pointing to the new output. We'll do this using the open and dup2 functions. There are two default outputs in Unix systems, stdout and stderr. stdout is associated with file descriptor 1 and stderr to 2.


I am going to execute a Process (lame.exe) to encode a WAV file to MP3.

I want to process the STDOUT and STDERR of the process to display progress information.

Do I need to use threading? I can't get my head around it.

Some simple example code would be appreciated.

Thanks