title: CreateProcess and command line arguments
body: <p><strong>Background Info:</strong> Windows 7, Visual C++ 2010 Express</p>
  
  <p><strong>Problem:</strong> CreateProcess() keeps returning with 'Invalid command line argument'</p>
  
  <p><strong>Explanation:</strong> I'm writing a piece of code that calls external programs using the Windows API's CreateProcess. I've gotten the call to work with one external program so far:</p>
  
  <pre><code>if( !CreateProcess( "C:\\Temp\\convert.exe",
      t_str,        // Arguments
      ...
  }
  //where t_str is " C:\\img1.jpeg C:\\img1.pgm" (ImageMagick if you're wondering). 
  </code></pre>
  
  <p>This works perfectly even with the amount of data-mangling I did to push everything into the Windows strings and pointers. So I copied all of the mangling for CreateProcess() for another call to a different external program:</p>
  
  <pre><code> if( !CreateProcess( "C:\\Temp\\sift.exe",
       t_str2,        // Arguments
       ...
   }
   //where t_str2 is ` &lt; C:\\img1.pgm &gt; C:\\img1.key`
  </code></pre>
  
  <p>Basically, something very similar, but with all the variable names changed (since I have these two calls running serial). And this is where the problem is; this doesn't run, and, instead, prints out "Invalid command line argument: &lt; C:\img1.pgm". Of course, this command works fine in the command prompt, but not in my code.</p>
  
  <p>I switched t_str2 to something else a little less complicated(since I know how sift.exe works) and I get the same result. Same thing happens when I run just sift and not convert. </p>
  
  <p><strong>Question:</strong> What could be causing this problem? What could I do to further debug this problem? Any suggestions on alternatives to the methods I'm using? Any help is appreciated. I can provide further code, but It's pretty straight forward, and not much could go wrong with it.</p>