Beispiel #1
0
void RhoSettings::saveToFile(const char* szName)
{
    m_mapChangedValues.put(szName, getString(szName) );

    String strData;
    saveChangesToString(strData);

    CRhoFile oFile;
    oFile.open( (getConfFilePath()+CONF_CHANGES).c_str(), common::CRhoFile::OpenForWrite);
    oFile.write( strData.c_str(), strData.size() );
}
Beispiel #2
0
void RhoSettings::saveToFile(const char* szName, boolean bRemove/* = false*/)
{
    if ( !bRemove )
        m_mapChangedValues.put(szName, getString(szName) );
    else
        m_mapChangedValues.remove(szName);

    String strData;
    saveChangesToString(strData);

    CRhoFile oFile;
    oFile.open( (getAppConfUserFilePath()+CONF_CHANGES).c_str(), common::CRhoFile::OpenForWrite);
    oFile.write( strData.c_str(), strData.size() );
}
Beispiel #3
0
/*static*/ unsigned int CRhoFile::copyFile(const char* szSrcFile, const char* szDstFile) {
    
    CRhoFile src;
    CRhoFile dst;
    
    if (!src.open(szSrcFile, OpenReadOnly)) {
        return -1;
    }
    if (!dst.open(szDstFile, OpenForWrite)) {
        return -1;
    }
    
    unsigned int buf_size = 1 << 16;
    unsigned char* buf = new unsigned char[buf_size];
    
    unsigned int to_copy = src.size();
    
    while (to_copy > 0) {
        unsigned int portion_size = buf_size;
        if (to_copy < portion_size) {
            portion_size = to_copy;
        }
        src.readData(buf, 0, portion_size);
        dst.write(buf, portion_size);
        
        to_copy -= portion_size;
    }
    
    src.close();
    dst.flush();
    dst.close();
    
    delete buf;

    return 0;
}