I have found many examples of coding on how to execute cmd.exe and execute a command, and execute even nslookup and interact, but the problem I am having is with a particular dos program that when it starts, it does not stop "outputting". here is some code and I will put a comment and the errors I get from C#

Here is how I have it setup in a more advanced way so I can receive output from the program on events

```
public void StartApplication(string appNameAndPath)
{
        StreamReader outputStream;
        Process p = new Process();
        p.StartInfo.FileName = appNameAndPath;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.CreateNoWindow = false;//for now just so I can see it
        p.Start();
//here is my advanced example
if(advanced == true)
{
        outputStream = p.StandardOutput;
        DoReadOutPut();
}
else
{//here is a simple example 
    while (p.StandardOutput.ReadLine() != null)  //this hangs here until the application exists
    {
        txt += (p.StandardOutput.ReadLine());
    }
}
}

 void DoReadOutput()
 {
        outputStream.BaseStream.BeginRead( readOutputBuffer, 0, readOutputBuffer.Length, new AsyncCallback( OnReadOutputCompleted ), null );  
       //this does sometimes fire but only with 0 bytes, on other dos programs it would say Memory read not allowed
 }

 void OnReadOutputCompleted( IAsyncResult result )
 {
        int cbRead = outputStream.BaseStream.EndRead( result );
        ProcessOutput( readOutputBuffer, cbRead );
        DoReadOutput();
 }

 private void ProcessOutput(byte[] buffer, int cbRead)
 {
        string text = p.StartInfo.StandardOutputEncoding.GetString(buffer, 0, 10000); //this is where it hangs until the program exits or is not writing anymore
        this.Invoke((Action)delegate
        {

            SetTextBoxValue(text);//im doing this because im on another thread otherwise textBox1.Text - text"

        });
  }

```

I do not want to have to use API and `GetText` and create an engine to `ReadLastLine`, can anyone help me with this? I suppose you would want an example exe, creating a C# application that `while(true){Console.WriteLine("bla");}` would suffice as the example exe but not the exe I am having trouble with. The exe takes over the dos window and has an "old school interface"