title: system() and CreateProcess() / CreateProcessW()
body: <p>I want to execute a TEST.exe in a C program. While I use</p>
  
  <pre><code>system( "TEST.exe &lt;input-file&gt; output-file" );
  </code></pre>
  
  <p>I can get what I expected.</p>
  
  <p>But CreateProcessW() didn't work properly when I use the following code (see <a href="https://stackoverflow.com/questions/9550488/how-do-i-run-an-external-program">How do I run an external program?</a>):</p>
  
  <pre><code>if (CreateProcessW(const_cast&lt;LPCWSTR&gt;(FullPathToExe.c_str()), 
      pwszParam, 0, 0, false, 
      CREATE_DEFAULT_ERROR_MODE, 0, 0, 
      &amp;siStartupInfo, &amp;piProcessInfo) != false) 
  { 
      /* Watch the process. */ 
      dwExitCode = WaitForSingleObject(piProcessInfo.hProcess,  (SecondsToWait * 1000)); 
      iReturnVal = GetLastError(); 
  } 
  else 
  { 
      /* CreateProcess failed */ 
      iReturnVal = GetLastError(); 
  } 
  </code></pre>
  
  <p>where</p>
  
  <pre><code>FullPathToExe="TEST.exe", pwszParam="TEST.exe &lt;input-file&gt; output-file".
  </code></pre>
  
  <p>And WaitForSingleObject() returns 258, GetLastError() returns 1813 ("The specified resource type cannot be found in the image file.").</p>
  
  <p>Also, The above CreateProcessW() code works fine when I run my own HelloProcess.exe (print hello, and sleep some seconds determined by the following number, then exit.) with </p>
  
  <pre><code>FullPathToExe="HelloProcess.exe", pwszParam="HelloProcess.exe 10".
  </code></pre>
  
  <p>Any ideas? Thanks for any hints!</p>