I have asked earlier if there was a combination of openmode to avoid modifications of an existing file. Now I would like to know if the contrary is possible :
- if the file already exists, truncate it (
std::ios::trunc
) - if the file does not already exist, do nothing
Is there an std::ios::openmode
available to do that with an std::ofstream
?