Dov Grobgeld schrieb:
In my efforts to of making sure that I can do simple constructs with the
language I tried to read a file line by line.
Use GIO instead, it's part of the GLib namespace.
http://library.gnome.org/devel/gio/stable/
File.read () will give you a FileInputStream which you can decorate as
a DataInputStream, then you can read line by line.
------
File my_file = File.new_for_path ("myfile.data");
DataInputStream in_stream;
try {
in_stream = new DataInputStream (my_file.read (null));
string line;
while (null != (line = in_stream.read_line (null, null))) {
print (line);
}
} catch (Error e) {
critical (e.message);
} finally {
in_stream.close (null);
}
------
You will have to compile with "--pkg gio-2.0". Currently you will get
some warnings about nullable parameters, since they aren't marked yet in
the vapi bindings, which you can safely ignore.
Frederik
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list