Skip to content
Snippets Groups Projects

Add ofstream support within the language

4 files
+ 25
3
Compare changes
  • Side-by-side
  • Inline

Files

+ 7
2
@@ -6,7 +6,12 @@ OFStream::OFStream(const std::string& filename)
{
if (parallel::rank() == 0) {
m_fstream.open(filename);
Assert(m_ostream == nullptr, "ostream was already defined");
m_ostream = &m_fstream;
if (m_fstream.is_open()) {
m_ostream = &m_fstream;
} else {
std::stringstream error_msg;
error_msg << "cannot create file " << rang::fgB::yellow << filename << rang::style::reset;
throw NormalError(error_msg.str());
}
}
}
Loading