My Process is GCC.exe which is in the same folder as my executable.
My 开发者_Go百科target is to pass a file as an argument in gcc
and produce the compiled file.
Why is this not working?
private void btnc_Click(object sender, EventArgs e)
{
Process GCC = new Process();
GCC.StartInfo.FileName = "gcc.exe" ;
GCC.StartInfo.Arguments = this.sourcefile.Text;
GCC.Start();
GCC.Close();
}
You are not waiting for the process to end before closing it.
Try: GCC.WaitForExit()
GCC.Start();
starts a process asynchronously while GCC.Close();
kills it. So, skip Close()
.
精彩评论