Retrieving Process output as it is written by the Process applicat

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Is there a way to capture the standard output from an application running in
a System.Diagnostics.Process() as the output is written? MSDN mentions that
the process writes to a pipe and when the buffer is full it must be retrieved
by the parent of the Process. I would like to retrieve the data realtime,
not wait for the process to either complete or for the buffer to fill. If
this isn't possible is there a way to reduce the size of the buffer to make
it appear that the retrieval is realtime?

Process p = new Process();

p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = @"c:\perl\bin\perl.exe";
p.StartInfo.Arguments = "test.pl";
p.Start();
textBox1.Text += p.StandardOutput.ReadToEnd();
p.WaitForExit();
.



Relevant Pages

  • Re: Simulink store/retrieve values during simulation
    ... Is there really no way that you can store and retrieve data values during a simulink simulation like you can do with a written loop in an standard m-file? ... or in the signal processing blockset look at the buffer or delay line blocks. ...
    (comp.soft-sys.matlab)
  • Serializing a data buffer from C++
    ... The buffer contains some fixed header fields followed by zero or more 'rows' ... The problem that I see is that the serialization process adds contextual ... All of the methods used to retrieve fields from the ... object rather than a raw binary stream. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: GetAsyncKeyState(vKey) & 0x8000
    ... isn't there a function to retrieve a keypress from the ... so the buffer remains 'empty', ... i'm writing a 3d engine. ... out the DirectX docs and groups for a definitive answer. ...
    (microsoft.public.vc.language)
  • Re: Running IDE as a standard user in Vista
    ... The first call passes 0& to retrieve the length needed for the buffer. ... If this is the real code then you're ... trying to run with limited rights. ...
    (microsoft.public.vb.general.discussion)
  • Re: DMS Nortel switch - getting all data
    ... > Nortel DMS switch. ... Once I've logged in I have to wait to retrieve the ... > contents of the buffer. ... The problem is when perl retrieves ...
    (comp.lang.perl.misc)