digitalmars.D.learn - Bug in File.byRecord ?
- closescreen (22/22) Jul 26 2017 I have a file with empty lines: 2,3 and 5,6
- =?UTF-8?Q?Ali_=c3=87ehreli?= (4/26) Jul 26 2017 Yes, I think it's a bug.
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?
Jul 26 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
Jul 26 2017