Bug in File.byRecord ?
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 26 10:21:10 PDT 2017
On 07/26/2017 04:51 AM, closescreen wrote:
> 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?
Yes, I think it's a bug.
Ali
More information about the Digitalmars-d-learn
mailing list