Newbie: Error parsing csv file with very long lines
Nicholas Wilson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Apr 23 04:13:19 PDT 2016
On Saturday, 23 April 2016 at 10:57:04 UTC, salvari wrote:
> Fixed!!!
>
> Thanks a lot. :-)
>
>
> But I have to think about this. I don't understand the failure.
stdin.byLine() reuses its buffer. so the old arrays in columns
point to the data in byLine's buffer and they get overwritten by
subsequent calls.
Also if you're trying to parse csv check out std.csv
from the docs
string str = "Hello;65;63.63\nWorld;123;3673.562";
struct Layout
{
string name;
int value;
double other;
}
auto records = csvReader!Layout(str,';');
foreach(record; records)
{
writeln(record.name);
writeln(record.value);
writeln(record.other);
}
More information about the Digitalmars-d-learn
mailing list