title: How to avoid space splitting and quote removal with _spawnvp()
body: <p>On Unix, we can create a new process with fork(); execvp(argv[0], argv); (with a bit of plumbing working out if we are the parent or child following the fork). In the child process, main(argc, argv) will see the strings exactly as they were passed to execvp.</p>
  
  <p>On Windows, the _spawn() family basically implements fork(); exec(); in one step. So far, so nice. The problem is that by the time we get to main() in the child, our strings are not what they were. Let me give an example.</p>
  
  <pre><code>argv[0] = "foo";
  argv[1] = "bar";
  argv[2] = "Use spaces and \"quotes\"";
  _spawnvp(0, argv[0], argv);
  </code></pre>
  
  <p>When we get to the child, in main() we will find that, in this example, argv[0] and argv[1] are as expected, but argv[2] has been tokenized on spaces and quotes removed such that</p>
  
  <pre><code>argv[2] == "Use"
  argv[3] == "and"
  argv[4] == "quotes"
  </code></pre>
  
  <p>How can I pass an argv structure from the parent to child as is, with it being reinterpreted and altered?</p>