选项文件选项无效:pad = oper

时间:2012-04-10 06:25:00

标签: c# .net command-line command-line-arguments astyle

获取此错误:尝试通过C#

调用Astyle时选项文件选项无效
  System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
    pProcess.StartInfo.FileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\Astyle.exe";

    //strCommandParameters are parameters to pass to program
    //pProcess.StartInfo.Arguments = "--style=ansi --recursive  "+System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)+"/*.cpp";

    pProcess.StartInfo.Arguments = " options=none test.cpp";
    //pProcess.StartInfo.Arguments = " -h";
    pProcess.StartInfo.UseShellExecute = false;

    //Set output of program to be written to process output stream
    pProcess.StartInfo.RedirectStandardOutput = true;
    pProcess.StartInfo.RedirectStandardError = true;
    //Optional
    pProcess.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

    //Start the process
    pProcess.Start();

    //Get program output
    string strOutput = pProcess.StandardOutput.ReadToEnd();
    string strError = pProcess.StandardError.ReadToEnd();
    //Wait for process to finish
    pProcess.WaitForExit();

1 个答案:

答案 0 :(得分:1)

如果您查看this link,正确的语法似乎是

--options=none