I have a C# application which calls a exe file. Below the code I used for calling the process:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "ContasillabeGame";
proc.StartInfo.Arguments = numeroSillabe + " " + numeroToken;
proc.OutputDataReceived += new DataReceivedEventHandler(OutputToTextArea);
proc.Start();
// Start the asynchronous read of the sort output stream.
proc.WaitForExit();
And here the method used for getting data retrieved from the process.
private void OutputToTextArea(object sendingProcess, DataReceivedEventArgs outLine)
{
// Collect the sort command output.
if (!String.IsNullOrEmpty(outLine.Data))
{
System.Console.WriteLine(outLine.Data);
}
}
With this code i launch app ContasillabeGame but i don't have any result from that app. Why? For send message from ContasillabeGame i use this code
Sample code for send message:
System.Console.WriteLine("pippo");