Summary: File.byLine terminator string
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from 2010-12-26 07:11:51 PST ---
This is the signature of File.byLine:

ByLine!(Char,Terminator) byLine(Terminator = char, Char = char)
(KeepTerminator keepTerminator =, Terminator terminator =

But on Windows the line terminators are 2 chars long (CR+LF), see:

So I think the second argument of argument byLine() needs to be a string.

This is code I expected to use, that currently is not accepted:

import std.stdio;
void main() {
    auto lines = File("test.txt").byLine(, "\r\n");


After that bug report, a little enhancement request: generally on Windows I
usually open files with Windows-style line terminators, while on Linux I open
files with Unix-style line terminators, so if possible a better default for the
second argument of byLine() is a string constant that changes according to the
operating system.


A workaround is to open the file in text mode, but I don't know if this works
well if you want to open a Windows-style file on Linux:

import std.stdio;
void main() {
    auto lines = File("test.txt", "r").byLine();

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to