471,318 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

Retrieving Process output as it is written by the Process applicat

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();
Jul 22 '05 #1
0 1083

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by jas | last post: by
4 posts views Thread by Steve | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.