On Saturday, 18 February 2012 at 10:19:06 UTC, bioinfornatics wrote:
import std.string;
import std.stdio;

void main(  ){
    File tmp = File.tmpfile();
    tmp.writeln( "ok" );
    tmp.writeln( "D is Fun" );
    writefln( "fileName: %s", tmp.name );
    foreach( line; tmp.byLine() )
        writefln( "l: %s", line );
}
...
why i can not iterate over line?

You can, but the file is still open and you are at the end of the file.

Try:
     tmp.rewind;
     foreach( line; tmp.byLine() )
         writefln( "l: %s", line );


Reply via email to