Skip to content
Snippets Groups Projects
Commit 450fc261 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Implemented OFile::rewind

parent 4f9680e3
No related branches found
No related tags found
No related merge requests found
......@@ -280,6 +280,16 @@ OFile& OFile::open(const std::string&path){
return *this;
}
OFile& OFile::rewind(){
// we use here "hard" rewind, which means close/reopen
// the reason is that normal rewind does not work when in append mode
plumed_assert(fp);
clearFields();
fclose(fp);
fp=std::fopen(const_cast<char*>(path.c_str()),"w");
return *this;
}
}
......@@ -184,6 +184,8 @@ this method can be used to clean the field list.
/// Formatted output with << operator
template <class T>
friend OFile& operator<<(OFile&,const T &);
/// Rewind a file
OFile&rewind();
};
/// Write using << syntax
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment