I have this simple code, in Genie syntax:

init
        var f = FileStream.open("/tmp/0setup-raw-db","r")
        var a = new array of char[2048]
        while f.eof() != true
                f.gets(a)                   /*read one line from file*/
                a[a.length - 1] = 0         /*make it null-terminated*/
                var ONELINE = (string)a           /*caste array-of-char to a 
string*/
                print "%s", ONELINE

It reads a text file line by line and prints it. Problem is, it prints
the last line twice, but only if the last line has a carriage-return.
It is standard practice in Unix/Linux for the last line of a text file
to have a carriage-return, so is this a bug? If so, I'll report it to
bugzilla.

Note, I get this behaviour in Vala 0.5.1 and 0.5.7.

Regards,
Barry Kauler
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to