Re: Weird behaviour with File.eof

2015-09-22 Thread crimaniak via Digitalmars-d-learn
On Sunday, 20 September 2015 at 20:17:37 UTC, Dandyvica wrote: My file is made of 10 lines: cat numbers.txt 1 2 3 4 5 6 7 8 9 10 ╰─$ wc -l numbers.txt CR/LF can be interpreted as line _dividers_, so if you have CR or CR/LF at the end of line 10, really here is line 11 which is empty. Remove

Re: Weird behaviour with File.eof

2015-09-20 Thread Daniel Kozák via Digitalmars-d-learn
V Sun, 20 Sep 2015 20:17:36 + Dandyvica via Digitalmars-d-learn napsáno: > Hi all, > > I can't explain to myself this weird behavior: > > void main(string[] argv) > { > char[] line; > auto fh = File(argv[1]); > while (!fh.eof) { > writef("before readln eof=%s

Weird behaviour with File.eof

2015-09-20 Thread Dandyvica via Digitalmars-d-learn
Hi all, I can't explain to myself this weird behavior: void main(string[] argv) { char[] line; auto fh = File(argv[1]); while (!fh.eof) { writef("before readln eof=%s, ", fh.eof); fh.readln(line,std.ascii.newline); writefln(