title: How do you pre-allocate space for a file in C/C++ on Windows?
body: <p>I'm adding some functionality to an existing code base that uses pure C functions (<code>fopen</code>, <code>fwrite</code>, <code>fclose</code>) to write data out to a file.  Unfortunately I can't change the actual mechanism of file i/o, but I have to pre-allocate space for the file to avoid fragmentation (which is killing our performance during reads).   Is there a better way to do this than to actually write zeros or random data to the file?  I know the ultimate size of the file when I'm opening it.  </p>
  
  <p>I know I can use fallocate on linux, but I don't know what the windows equivalent is.</p>
  
  <p>Thanks!</p>