title: mkstemp() implementation for win32
body: <p>Can anybody point me to the code that implements mkstemp() (C/C++) on Win32, or very close analog. </p>
  
  <p>Must be race-free. </p>
  
  <p>It's supposed to look like</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;io.h&gt;
  
  // port of mkstemp() to win32. race-free.
  // behaviour as described in http://linux.die.net/man/3/mkstemp
  // 
  int mkstemp(char *template) {
       ...
  }
  </code></pre>
  
  <p>Thanks</p>