Re: Using Glib::KeyFile



Hi.

GKeyFile does not automatically updates file on a disk. When you open
your file with "load_from_file" method, file is parsed and stored in
memory as a structure. And when you edit you key file, you are
actually editing your memory copy of it. To write changes to your
file, you need to "dump" your memory file into string with to_data
method and then save the resulting ustring to file.


2008/12/12 Ravee Kondrakunta <Ravee_Kondrakunta phoenix com>:
Hi,

I was trying to use Glib::KeyFile to parse and also to edit it.

I was able to parse the file and read information from it, but I was not able to set it using that. Its not 
updating my config file. I crossed the permissions given on the file too.

Here is the piece of the code for reference.

Glib::KeyFile key;

try
{
key.load_from_file("/home/localuser/RnD/DateTime/datetime.config");
}
catch(Glib::KeyFileError ex)
{
std::cout << ex.what() << std::endl;
}
key.set_comment("PREFERENCES", "DateTimeApp Settings");

I tried using set_string, set_integer to set the the new value for a key. But nothing worked out.

-Ravee
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




-- 
Tadej BorovÅak
00386 (0)40 613 131
tadeboro gmail com
tadej borovsak gmail com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]