I want to write some text to a file with a randomly chosen filename, but want to require that the file doesn't exist yet. There's a race-condition between a simple QFile::exists check followed by an open with the checked name.
What's the best way to ensure that the file wasn't pre-existing when I open it with QFile? The same thing with a directory works nicely when using boost::filesystem::create_directory, because it returns a boolean that indicates whether a directory was pre-existing or not. But I don't see how it works for files.