mystream = false;
stream = &_stream;
- assert(valid());
+ if (!valid())
+ fatal("Unable to open output stream for writing\n");
}
void
mystream = true;
stream = new ofstream(file.c_str(), ios::trunc);
- assert(valid());
+ if (!valid())
+ fatal("Unable to open statistics file for writing\n");
}
bool
Text::valid() const
{
- return stream != NULL;
+ return stream != NULL && stream->good();
}
void
string cpt_file = dir + Checkpoint::baseFilename;
ofstream outstream(cpt_file.c_str());
time_t t = time(NULL);
+ if (!outstream.is_open())
+ fatal("Unable to open file %s for writing\n", cpt_file.c_str());
outstream << "// checkpoint generated: " << ctime(&t);
globals.serialize(outstream);