util.hpp
// write contents to file
// If add_flag is true, this function works as the append mode.
// Otherwise, it rewrites the file.
write contents to file
If add_flag is true, this function works as the append mode.
Otherwise, it rewrites the file.
write contents to file If add_flag is true this function works as the append mode . Otherwise it rewrites the file .
static void write_file(const char *file, const string *contents, bool add_flag){
  ofstream f;
  if(!add_flag){
    f.open(file, ios::out);
  }else{
    f.open(file, ios::app);
  }
  f << *contents << endl;  
  f.close();
}
static void write_file ( const char * file , const string * contents , bool add_flag ) { ofstream f ; if ( ! add_flag ) { f . open ( file , ios :: out ) ; } else { f . open ( file , ios :: app ) ; } f << * contents << endl ; f . close ( ) ; }
write contents to file
If add_flag is true, this function works as the append mode.
write contents to file If add_flag is true this function works as the append mode .