How do I redirect output from a DOS app into DotNet app (pipe)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to take the output of a DOS console application that just streams data
to the screen and redirect that output in real time into a C# application
that will decode and reformat it for display. I know I could redirect from
the DOS application into a file and then read the file, but I want to do this
in real-time so I can affect the output of the DOS application and
immediately see the results in the C# app.

The DOS application is not ours, and there is no option to re-write it.

Can anyone point me in the right direction to get this done, or tell me why
it can’t?
 
You need to to start the DOS application from within your C# application
using the System.Diagnostics.Process and System.DiagnostivsProcessInfo
classes. When you are setting up the info to start the process using the
ProcessInfo class you can redirect the standard output stream of the dos
application and send it to a StreamReader or some other .NET class that
derives from System.IO.Stream.

Hope this helps


--
Brian Delahunty
Ireland

http://briandela.com/blog

INDA SouthEast - http://southeast.developers.ie/ - The .NET usergroup I
started in the southeast of Ireland.
 
Back
Top