File() vs. std.cstream.din
Gerome Fournier
Gerome_member at pathlink.com
Mon Apr 24 10:57:02 PDT 2006
In article <ops8hex0ap23k2f5 at nrage.netwin.co.nz>, Regan Heath says...
>
>Ideally it should return a line which is not null but has a length of 0
>i.e. an empty line. Until it does, it looks like you're stuck with:
>
>while(true) {
> char[] line = s.readLine();
> if (line is null) {
> if (s.eof) break;
> line = "";
> }
> writefln("Line: %s",line);
>}
>
>or similar.
Yep, this workaround sounds good.
>> I've even noticed that calling readLine on a non seekable Stream (like
>> std.cstream.din) on a file using the dos '\r\n' end of line sequence,
>> will stop when '\r' is seen. And a second call to readLine will stop on
>> the following '\n'. The sequence '\r\n' is not eaten as a whole end of
>> line sequence, like it's done for a seekable stream.
>
>That's a bug that needs to be fixed.
I'll post something about it under digitalmars.D.bugs.
More information about the Digitalmars-d
mailing list