开发者

Problems in passing arguments in gcc

开发者 https://www.devze.com 2023-02-19 14:57 出处:网络
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.

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

精彩评论

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