זאת פונקצייה לדוגמא שמוסיפה טקסט לקובץ
public static bool addLineToFile(string file_path, string line) {var file = File.new_for_path (file_path);
string buffer = line;
if (!file.query_exists (null)){
stderr.printf ("File '%s' doesn't exist.\n", file.get_path ());
return false;
}
try {
FileOutputStream file_stream =
file.append_to(FileCreateFlags.NONE,null);
file_stream.write((void*) buffer, line.len(), null);
}
catch(GLib.Error e) {
print("%s\n", e.message);
}}
catch(GLib.Error e) {
print("%s\n", e.message);
return true;
}
אין תגובות:
הוסף רשומת תגובה