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

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

Post by Qnlyb2 » Sun, 14 Aug 2005 00:25:30


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?
 
 
 

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

Post by QnJpYW4gRG » Sun, 14 Aug 2005 02:23:02

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://www.yqcomputer.com/

INDA SouthEast - http://www.yqcomputer.com/
started in the southeast of Ireland.