does std.file.slurp work with string data field?
Big Tummy
bigtummy at gmail.com
Thu Dec 26 17:40:44 PST 2013
I have a file containing data like,
--- data.txt ---
abc, 1
def, 2
--- end data.txt ---
I try to read in the data like following, but the the codes do
not compile:
--- mytest.d ---
import std.file, std.stdio;
void main() {
auto arr = "data.txt".slurp!(string, int)("%s, %s");
foreach(a; arr) {
writefln("%s: %d", a[0], a[1]);
}
}
--- end mytest.d ---
Any idea?
Thanks in advance,
Big Tummy
More information about the Digitalmars-d
mailing list