开发者

Problems in passing arguments in gcc

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().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜