is there a way to indicate if a process like standard calculator got an output or not,
i need it because i have this line :
sr = p1.StandardOutput;
and i need to do this :
s = sr.ReadLine();
only if there's an output from p1
in calculator for example there's no output so the program stuck after the ReadLine
.
thanks all.
the code :
while (i < asProcesses.Length - 1)
{
if ((i + 1) == asProcesses.Length - 1 && sOutRedirect != "")
break;
p1.StartInfo.RedirectStandardOutput = true;
p1.StartInfo.FileName = asProcesses[i];
p1.StartInfo.UseShellExecute = false;
if(i==0)
p1.Start();
sr = p1.StandardOutput;
Process p2 = new Process();
p2.StartInfo.RedirectStandardInput = true;
p2.StartInfo.FileName = asProcesses[i + 1];
p2.StartInfo.UseShellExecute = false;
p2.Start();
sw = p2.StandardInput;
while (!sr.EndOfStream && s != null)
{
s = sr.ReadLine();
if (s != null)
{
sw.WriteLine(s);
}
}
if (sw != null)
sw.Close();
if (sr != null)
sr.Close();
i++;
}