Redirecting Command-line Arguments for Bootstrapping

I am trying to rewrite the following program in C instead of C# (which is less portable). It is obvious that "int system ( const char * command )" will be necessary to complete the program. Starting it with "int main ( int argc, char * argv[] )" will allow getting the command-line arguments, but there is still a problem that is difficult to understand. How do you successfully escape arguments with spaces in them? In the program below, arguments with spaces in them (example: screensaver.scr "this is a test") will be passed to the script as separate arguments (example: screensaver.scr this is a test) and could easily cause problems.

namespace Boids_Screensaver
    static class Program
        static void Main(string[] args)
            System.Diagnostics.Process python = new System.Diagnostics.Process();
            python.EnableRaisingEvents = false;
            python.StartInfo.FileName = "C:\\Python31\\pythonw.exe";
            python.StartInfo.Arguments = "boids.pyw";
            foreach (string arg in args)
                python.StartInfo.Arguments += " " + arg;


The correct way to do this under windows is to use _spawnv

Its equivalent under unix like OSes is fork() followed by execv.

Windows is all messed up. Every program has its own rules.

Need Your Help

Is there a way to bulk format code in Sublime Text?

javascript html css sublimetext code-formatting

Is there a plugin, or setting in Sublime Text that will enable project-level code formatting and application of the .EditorConfig plugin?