1 #ifndef CASM_SafeOfstream
2 #define CASM_SafeOfstream
67 throw std::runtime_error(
68 std::string(
"Error in 'SafeOfstream::open(fs::path name, std::string tmp_ext)'.\n") +
69 " File: " +
m_tmp_name.string() +
" already exists");
void close()
Closes stream, and if not a failed write, removes "file" and renames "file.tmp" to "file"...
Write to a temporary file to ensure a good write, then rename.
fs::ofstream & ofstream()
Access underlying stream.
void open(fs::path name, std::string tmp_ext="tmp")
Opens "file.tmp" for writing, with intended final target "file".