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

Reply via email to