Read csv data into a struct
Yao Gomez
yao.gomez at gmail.com
Fri Mar 2 14:01:05 PST 2012
On Friday, 2 March 2012 at 21:50:12 UTC, tjb wrote:
> Woops. I have a mistake in the code. Should be:
>
> import std.stdio : writeln;
> import std.stream;
>
> void main() {
> auto fin = new File("temp.csv");
> char[] line;
>
> int count;
> while(!fin.eof()) {
> line = fin.readLine();
> writeln(line);
> }
> }
>
> Thanks!
>
> TJB
Check this module: http://dlang.org/phobos/std_csv.html
It can parse the CVS file content into a custom class/struct.
More information about the Digitalmars-d-learn
mailing list