62,267
社区成员
发帖
与我相关
我的任务
分享 Process p;
ProcessStartInfo psi = new ProcessStartInfo();
// process options
psi.FileName = "g++";
psi.Arguments = "-o result "+srcFileName;
psi.CreateNoWindow = true;
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
psi.ErrorDialog = true;
// start process
p = Process.Start(psi);
// get result when process is over
p.WaitForExit();
string result = p.StandardOutput.ReadToEnd();
// release resource
p.Close();
p.Dispose();