On 30.11.2009 7:02, retard wrote:
foreach (line; new Lines!(char) (new File ("foobar.txt")))
   Cout (line).newline;
}


To be fair, it's a bit simpler than that in Tango:

foreach (line; new TextFileInput("foobar.txt"))
   Cout (line).newline;
}

 2.  Read a whole file into an array of bytes.

new File("foobar.bin").read()


This one too:

auto contents = File.get("foobar.bin");

get is a static method in the File class.


But I won't pretend that I think Tango I/O is easy to use. There's a lot of interfaces and classes, and usually several ways to accomplish the same thing. Some classes are just thin wrappers over others, which can be confusing.

Reply via email to