title: How to create a new binary file and fill it with a constant value?
body: <p>I'm using <code>cstdio</code> functions to create an empty binary file and need it to be initialized to a specific byte value (can be zero, but not necessarily).</p>
  
  <pre><code>FILE* file = std::fopen("path/to/file", "wb+");
  </code></pre>
  
  <p>Is there a way to fill the whole file with a value, or is creating and filling a buffer and then using <code>std::fwrite</code> to continuously fill the file my only option? Something like</p>
  
  <pre><code>std::ffill(byteValue, sizeof(byteValue), fileSize, file);
  </code></pre>
  
  <p>It would be okay to have platform specific solutions (I'm targeting windows and linux).</p>