Re: [Vala] Need help with string



using GLib;

public static void main(string[] args)
{
       KeyFile kf = new KeyFile();
       try {
               kf.load_from_file("test.ini", KeyFileFlags.NONE);
               stdout.printf("==> file0=%s\n",
                       kf.get_value("LastFiles", "file0"));
       } catch (FileError err) {
               kf.set_string("LastFiles", "file0", "patata");
               var str = kf.to_data(null);
               FileUtils.set_contents("test.ini", str, str.length);
               stdout.printf("%s\n", str);
       }
}


Nicolas wrote:
Hi,

I try to make a little program who read in a file and take only some informations (like an .ini file).
My text file is like this:

[INFO]
blah
blah blah
blah blah blah

Could someone tell me how to create this kind of function ?

Thank you so much in advance,
Nicolas.


_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




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