im starting a console application,
but when I redirect the standardoutput I always get nothing!!
when I dont redirect it, and set createnowindow to false,
I see everything correctly in the console, but when I redirect it,
standardoutput.ReadToEnd() always returns an emty string.
Process cproc = new Process();
cproc.StartInfo.CreateNoWindow = true;
cproc.StartInfo.FileName = Dest;
cproc.StartInfo.RedirectStandardOutput = true;
cproc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
cproc.StartInfo.UseShellExecute = false;
cproc.EnableRaisingEvents = true;
cproc.Start();
cproc.Exited += new EventHandler(cproc_Exited);
while(!stop)
{
result += cproc.StandardOutput.ReadToEnd();
}
the eventhandler cproc_exited just sets stop to true.
can someone explain why result is always string.Empty?