Logo Search packages:      
Sourcecode: inkscape version File versions

bool Pedro::XmppConfig::writeFile ( const DOMString &  fileName  )  [virtual]

Write a configuration file

Definition at line 225 of file pedroconfig.cpp.

References Pedro::XmppEventTarget::error(), read(), and toXmlBuffer().

{

    FILE *f = fopen(fileName.c_str(), "wb");
    if (!f)
        {
        error("Could not open configuration file '%s' for writing",
              fileName.c_str());
        return false;
        }

    DOMString buffer = toXmlBuffer();
    char *s = (char *)buffer.c_str();
    size_t len = (size_t) strlen(s);  //in case we have wide chars

    if (fwrite(s, 1, len, f) != len)
        {
        return false;
        }
    fclose(f);

    if (!read(buffer))
        return false;

    return true;
}


Generated by  Doxygen 1.6.0   Back to index