[Vala] I need help writing some function...



Hello.
I am trying to write some function that would append a line to a text file.

 public static bool addLineToFile(string file_path, string line) {
    var file = File.new_for_path (file_path);
    if (!file.query_exists (null)){
        stderr.printf ("File '%s' doesn't exist.\n", file.get_path ());
        return false;
    }
    FileOutputStream file_stream =
GLib.File.append_to(file,FileCreateFlags.NONE,null,null);

///////////////////TO BE CONTINUED...////////////////////////

    return true;
}

I know that the function is not finished yet, but why it doesn't compile?
If some one could give some sample code to do this function it will be great
because I can't find any good example
on the internet...

Thank you very much.


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