-2
此代碼與ipconfig.exe配合良好,但我沒有收到任何與我的目標應用程序。無法從控制檯進程獲得輸出
Process p = new Process();
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.FileName = "miner.exe";
p.StartInfo.Arguments = command;
p.EnableRaisingEvents = true;
p.OutputDataReceived += OutputDataReceived;
p.ErrorDataReceived += ErrorDataReceived;
p.Start();
p.BeginOutputReadLine();
p.StandardInput.Close();
有人可以告訴什麼可能是錯的,我該怎麼辦?目標應用程序是用C++編寫的,我認爲使用printf輸出。在論壇上,我看到一個人說,他不能讓這個應用程序與Linux中的管道工作。
應該編寫C++程序控制臺上的東西?如果是註釋掉CreateNoWindow行並再次嘗試 – Taleeb
如果正常運行(手動)它顯示在控制檯窗口中運行的文本行 –
您已寫入p.StartInfo.CreateNoWindow = true和p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; ...所以沒有創建控制檯窗口 – Taleeb