problem with byLine
Christian Köstlin
christian.koestlin at gmail.com
Mon May 14 01:41:54 PDT 2012
Hi,
i wanted to output an ascii-file line by line, but reversed.
the idea was to open the file, use byLine to read it line-by-line, make
this range an array, and retro this array.
But when i convert byLine to an array, the result is already trash.
Please see this snippet.
import std.stdio;
import std.array;
int main(string[] args) {
if (args.length != 2) {
throw new Exception("Usage: " ~ args[0] ~ " file1");
}
auto f = File(args[1], "r");
auto i = array(f.byLine());
foreach (l; i) {
writeln(l);
}
return 0;
}
Any idea why this happens?
regards
christian köstlin
More information about the Digitalmars-d-learn
mailing list