0

Doxygen provides a way to pass in the contents of the .doxy file through stdin rather than passing a file name, but I don't know how to do it from C#.

For simplicity let's say the contents of my doxygen config file are simply stored in string[] lines so I want to execute doxygen.exe and feed this content in.

Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
  • Possible duplicate of [How to write to stdin of another app?](http://stackoverflow.com/q/2613161) – Robert Harvey Jan 09 '13 at 18:28
  • My question covers more issues than that question, I think. I reckon there might be a doxygen-specific part of how to actually launch doxygen.exe to expect input from stdin using C#. – Mr. Boy Jan 09 '13 at 19:01
  • That would undoubtedly be the minus sign (-) command line parameter that you would need to provide when launching Doxygen. See http://www.star.bnl.gov/public/comp/sofi/doxygen/starting.html. See also [Launching a Application (.EXE) from C#?](http://stackoverflow.com/questions/240171) – Robert Harvey Jan 09 '13 at 20:52

1 Answers1

0

I got this working myself from the links mentioned in the comments, something along the lines of:

// Prepare the process to run
    ProcessStartInfo start = new ProcessStartInfo();
    // Enter in the command line arguments, everything you would enter after the executable name itself
    start.Arguments = " -";
    // Enter the executable to run, including the complete path
    start.FileName = "doxygen.exe";
    // Do you want to show a console window?
    start.WindowStyle = ProcessWindowStyle.Normal;
    start.CreateNoWindow = false;
    start.RedirectStandardInput = true;
    start.UseShellExecute = false;

    // Run the external process & wait for it to finish
    using (Process proc = Process.Start(start))
    {
        //doxygenProperties is just a dictionary
        foreach (string key in doxygenProperties.Keys)
            proc.StandardInput.WriteLine(key+" = "+doxygenProperties[key]);
        proc.StandardInput.Close();
        proc.WaitForExit();

        // Retrieve the app's exit code
        int exitCode = proc.ExitCode;
    }
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589