csvReader read file byLine()?

Jens Mueller jens.k.mueller at gmx.de
Thu Jun 21 05:17:16 PDT 2012


Hi,

I used std.csv for reading a CSV file.
Thanks a lot to Jesse for writing and adding std.csv to Phobos.
Using it is fairly straightforward but I miss one thing. Very commonly
you need to read a CSV file. With std.csv that boils down to

auto records = csvReader!(Record)(readText(filename));

But csvReader won't parse from File(filename, "r").byLine() even though
that is an InputRange, isn't it? That means I always have to use
readText. All IO happens that very moment.
Shouldn't the csvReader support lazy reading from a file like this

auto file = File(filename, "r");
auto records = csvReader!(Record)(file.byLine());

Am I missing something? Was this left out for a reason or an oversight?

Jens


More information about the Digitalmars-d mailing list