title: CreateProcess,winapi,error code 3
body: <p>Here's my code. I always get error 3, what can I do? I tried to replace CreateProcces with CreateProcessA,replace first two param, try to process other program, but it still doesn't work.Thanks.</p>
  
  <pre><code>  #include "windows.h"
    #include &lt;iostream&gt;
  
    void main() {
  
       STARTUPINFOA cif;
       ZeroMemory(&amp;cif,sizeof(cif));
       PROCESS_INFORMATION pi;
       CreateProcessA("","C:\\Windows\\notepad.exe",NULL,NULL, NULL,NULL,NULL,NULL,&amp;cif,&amp;pi);
  
       DWORD error=GetLastError();
       std::cout &lt;&lt; "error " &lt;&lt; error &lt;&lt; "\n";
       while(1) {}        // подождать
   }
  </code></pre>
  
  <p>Yes,you`re right. i've corrected it, but it still returns error code 3.
  First,notepad.exe isn't executed, second, getlasteeror returns code error 3, what i did wrong?</p>
  
  <p>I place:</p>
  
  <pre><code>      char* path="C:\\Windows\\notepad.exe";
        CreateProcessA(path,"sfvfd",NULL,NULL,NULL,NULL,NULL,NULL,&amp;cif,&amp;pi);
  </code></pre>
  
  <p>instead of(and it's worked!):</p>
  
  <pre><code>      CreateProcessA("","C:\\Windows\\notepad.exe",NULL,NULL,            
        NULL,NULL,NULL,NULL,&amp;cif,&amp;pi);
  </code></pre>
  
  <p>What's the difference?</p>