title: Write large binary file in C
body: <p>I'm using 64bit mingw to compile c code on windows x64. 
  I'm using fwrite to create binary files from memory array. I want to write ~20Gb calling this function but it just write until 1.4~1.5gb and then it stops writting (without crashing, just hangs there.... doing nothing). 
  Is there any solution? Right now I'm writing 20 files and then I merge them. 
  Opening the file as 'ab' works but I cant read the file properly if I use that mode.</p>
  
  <p>Sample (pseudo)code:</p>
  
  <pre><code>    short* dst= malloc(20GB);
      *calculations to fill dst* 
      file=fopen("myfile",'wb');
      fwrite(dst, sizeof(short), 20GB/sizeof(short), file);
      fclose(file)
  </code></pre>
  
  <p>That program never ends and file size is never grater than 1.5GB</p>