title: Atomic writing to file on linux
body: <p>Is there a way to dump a buffer to file atomically?</p>
  
  <p>By "atomically" I mean: if for example someone terminates my application during writing, I'd like to have file in either before- or after-writing state, but not in a corrupted intermediate state.</p>
  
  <p>If the answer is "no", then probably it could be done with a really small buffers? 
  For example, can I dump 2 consequent int32_t variables with a single 8 bytes fwrite (on x64 platform), and be sure that both of those int32s are dumped, or neither of them, but not only just one of them?</p>