www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11431] New: std.file.slurp with Windows newlines

http://d.puremagic.com/issues/show_bug.cgi?id=11431

           Summary: std.file.slurp with Windows newlines
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-11-03 08:35:57 PST ---
If I create a simple "data.txt" file containing this, with Windows newlines:

10
20
30



And I try to read it with slurp:


import std.file: slurp;
void main() {
    slurp!(int)("data.txt", "%d");
}


I get a stack trace:

object.Exception ...\dmd2\src\phobos\std\file.d(2992): Trailing characters at
the end of line: `
'
---------
0x00413C36 in pure  safe void std.exception.bailOut(immutable(char)[], uint,
const(char[]))
...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 03 2013