title: Windows, fork and execv
body: <p>I have received a Unix tool that I want to run / compile under Windows. After looking at it, I see it uses <code>fork</code> and <code>execv</code> among others. I now want to understand what it does and how I can realize this in Windows.</p>
  
  <p>The code does more than asked here so please don't comment on whether this code makes sense.</p>
  
  <pre><code>pid = fork();
  if(pid==0){
      execv("/usr/bin/java",args);
  }
  </code></pre>
  
  <p>If I interpret this correctly, this one only does something like calling <code>java</code> with the arguments provided in the <code>args</code> array. So in Windows this could easily be realized by something like <code>system()</code> or <code>CreateProcess</code> (I did not read on <em>how</em> to do it, just know it can be done).</p>
  
  <p>But here is my question: If I understand it correctly this code forks and calls <code>execv</code> because <code>execv</code> does not return and my program would not finish without forking it first. Is this correct?</p>