I am executing an exe file which contains some c code from my c# winform but I get the complete output of the c code only after the complete execution of exe. I want the exe to relay its output to my winform synchronously (line by line in realtime).
var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "background.exe",
Arguments = command,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
while (!proc.StandardOutput.EndOfStream)
{
ConsoleWindow.AppendText(proc.StandardOutput.ReadLine());
ConsoleWindow.AppendText(Environment.NewLine);
}