On Unix, we can create a new process using fork (); execvp (argv [0], argv); (with a little plumbing if we are a parent or child following the plug). In the child process, main (argc, argv) will see the lines exactly as they were passed to execvp.
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 the main () of the child, our lines are not what they are. Let me give you an example.
argv[0] = "foo";
argv[1] = "bar";
argv[2] = "Use spaces and \"quotes\"";
_spawnvp(0, argv[0], argv);
When we move on to the child, in main () we find that in this example, argv [0] and argv [1] are as expected, but argv [2] has been denoted on spaces and the quotes are removed such that
argv[2] == "Use"
argv[3] == "and"
argv[4] == "quotes"
argv , , ?