c++ - Combination of std::ios::openmode to truncate if the file exists but prevent new file creation? -
i have asked earlier if there combination of openmode avoid modifications of existing file. know if contrary possible :
- if file exists, truncate (
std::ios::trunc
) - if file not exist, nothing
is there std::ios::openmode
available std::ofstream
?
to best of knowledge, there no such open mode (it not common use case). guess first check whether file exists and, if does, open trunc
open mode.
Comments
Post a Comment