Exemple #1
0
bool Database::saveToFile(const std::string &fileName , const char delim  ) const
{
    
    std::ofstream file;
    
    file.open( fileName.c_str() );
    
    if ( !file.is_open() )
        return false;
    
    Date now;
    Timecode t;
    t.setToCurrentTime();
    
    file << "########## Database file generated on " << now.toString().c_str()
    << " at " << t.getString(true,true,true,false).c_str() << " ##########" ;
    
    
    file <<  "\n";
    file <<  "\n";
    
    for (const DataPair &pair : _dataList )
    {
        file << pair.first << " " << delim << " " << pair.second.getString();
        file <<  "\n";
        file <<  "\n";
        
    }
    
    
    
    file.close();
    return true;
}