Phobos packages a bit confusing

bearophile bearophileHUGS at lycos.com
Mon Nov 30 14:52:29 PST 2009


Pelle MÃ¥nsson:

> foreach (line; open("foobar.txt")) {
>    writeln(line);
> }

With the xio module of my dlibs:
import d.xio: xfile;

foreach (line; xfile("foobar.txt"))
    putr(line);

xfile is optimized to reduce memory rellocations as much as possible in the most common case of about 90 chars long lines.
There is an xstdin too.

Bye,
bearophile



More information about the Digitalmars-d mailing list