My console program outputs "*" symbols to indicate progress.
I'd like to read this in order to update the progress bar in a Windows form:
int Progress=0;
System.Diagnostics.Process ProcessObj = new System.Diagnostics.Process();
ProcessObj.StartInfo.UseShellExecute = false;
ProcessObj.StartInfo.CreateNoWindow = true;
ProcessObj.StartInfo.RedirectStandardOutput = true;
ProcessObj.Start();
while(!ProcessObj.HasExited){
Progress+= ProcessObj.StandardOutput.ReadBlock(buffer, index, 1);
}
Progress+= ProcessObj.StandardOutput.ReadBlock(buffer, index, 1);
Usually, it waits till the process exits before reading anything at all (same for Read), though sometimes it will read the first 1 to 3 characters first.
Anyone know what is causing this?