Bug 11431 – std.file.slurp fails with Windows newlines
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-03T08:35:57Z
Last change time
2020-03-21T03:56:38Z
Keywords
pull
Assigned to
No Owner
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2013-11-03T08:35:57Z
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[]))
...