I'm writing an app that displays your current hashrate in Ethereum (A cryptocurrency like Bitcoin), and I need to somehow get the continuous output from the Command line that is running. This is what I have so far, but it is not printing to the program output:
pProcess.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
{
// Prepend line numbers to each line of the output.
if (!String.IsNullOrEmpty(e.Data))
{
System.Console.Write(e.Data);
}
});
//Wait for process to finish
pProcess.WaitForExit();
What is not working with this code? I'm guessing there's something messed up with the event handler, but I don't know what.