[Vala] Is this a bug or a feature?
- From: Barry Kauler <bkauler gmail com>
- To: Vala-list gnome org
- Subject: [Vala] Is this a bug or a feature?
- Date: Sat, 21 Mar 2009 06:46:47 +0800
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]