Read text file, line by line?

Kagamin spam at here.lot
Wed Dec 14 06:41:04 PST 2011


On Tuesday, 13 December 2011 at 14:08:15 UTC, Robert Clipsham 
wrote:
> On 13/12/2011 13:58, Iain S wrote:
>> How would one achieve this in D2?  I have tried for a couple 
>> of hours
>> now and have achieved nothing but stress.
>
> import std.stdio;
>
> void main() {
>    foreach(line; File("myTextFile.txt").byLine()) {
>        writefln(line);
>    }
> }

AFAIK it used to preserve EOL in the lines. Was it fixed?


More information about the Digitalmars-d-learn mailing list