bugfix _keep_existing name ; added an overwriting option to use ios_base::trunc instead of ios_base::app

This commit is contained in:
Johann Dreo 2010-09-15 22:53:15 +02:00
commit 9d19cc2cfa
2 changed files with 16 additions and 6 deletions

View file

@ -44,11 +44,16 @@ void eoFileMonitor::printHeader()
eoMonitor& eoFileMonitor::operator()(void)
{
ofstream os(filename.c_str(), ios_base::app);
ofstream os(filename.c_str(),
overwrite ?
ios_base::out|ios_base::trunc // FIXME does not seems to work
:
ios_base::out|ios_base::app
);
if (!os)
{
string str = "eoFileMonitor: Could not append to " + filename;
string str = "eoFileMonitor: Could not write to " + filename;
throw runtime_error(str);
}