Hello, here is simple pice of code to read text file into array
of lines:
import std.stdio;
void main(string args[]) {
auto file = File(args[1]);
auto frange = file.byLine();
char[][] buf;
foreach (char[] line; frange) {
buf = buf ~ line;
}
writeln(buf);
}
When i run this code for this text file:
--------------cutline-----------
hello
world
of D
and
have a nice day
--------------cutline-----------
then program prints:
["and\n\n", "and\n\n", "and\n", "and", "have a nice day!"]
As you can see, this is complete madness, any idea what is wrong
here ?