title: C++ open file for writing only if does not exists
body: <p>I would like to open a file for writing with the standard library, but the file open should fail if the file already exists.</p>
  
  <p>From what I can read in the documentation, ofstream::open only allows appending or truncating.</p>
  
  <p>I could of course try to open for reading to check if the file exists, and reopen for writing if it doesn't, but there is no guarantee that the file will not be created by another process inbetween.</p>
  
  <p>Could someone confirm this is not possible in C++ with the standard library (std::iostream) or with the C functions (FILE* functions)</p>