Bug in File.byRecord ?
closescreen via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 26 04:51:52 PDT 2017
I have a file with empty lines: 2,3 and 5,6
filename.csv (with linenumbers for better view in this message)
1>Joe,Carpenter,300000
2>
3>
4>Fred,Blacksmith,400000
5>
6>
Now, if I run:
rdmd
--eval='"filename.csv".File.byRecord!(string,string,int)("%s,%s,%d").writeln'
It prints:
[Tuple!(string, string, int)("Joe", "Carpenter", 300000),
Tuple!(string, string, int)("Joe", "Carpenter", 300000),
Tuple!(string, string, int)("Joe", "Carpenter", 300000),
Tuple!(string, string, int)("Fred", "Blacksmith", 400000),
Tuple!(string, string, int)("Fred", "Blacksmith", 400000),
Tuple!(string, string, int)("Fred", "Blacksmith", 400000)]
It happens because code in
https://github.com/dlang/phobos/blob/master/std/stdio.d#L297
not checks return value after call formattedRead.
Is this a bug? Or I not understand something?
More information about the Digitalmars-d-learn
mailing list