Paste number 71405: save key file

Paste number 71405: save key file
Pasted by: kalikiana
When:7 months, 1 day ago
Share:Tweet this! | http://paste.lisp.org/+1J3H
Channel:None
Paste contents:
Raw Source | XML | Display As
/* Copyright (c) 2008 Christian Dywan <christian@twotoats.de>
   This code is licensed under the terms of the LGPL2 license */

gboolean
sokoke_key_file_save_to_file (GKeyFile*    key_file,
                              const gchar* filename,
                              GError**     error)
{
    gchar* data;
    FILE* fp;

    data = g_key_file_to_data (key_file, NULL, error);
    if (!data)
        return FALSE;

    if (!(fp = fopen (filename, "w")))
    {
        *error = g_error_new (G_FILE_ERROR, G_FILE_ERROR_ACCES,
                              _("Writing failed."));
        return FALSE;
    }
    fputs (data, fp);
    fclose (fp);
    g_free (data);
    return TRUE;
}

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.