D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11431 - std.file.slurp fails with Windows newlines
Summary: std.file.slurp fails with Windows newlines
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2013-11-03 08:35 UTC by bearophile_hugs
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2013-11-03 08:35:57 UTC
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[]))
...
Comment 1 basile-z 2018-08-25 17:13:10 UTC
pull : https://github.com/dlang/phobos/pull/6680
Comment 2 github-bugzilla 2018-08-26 19:34:21 UTC
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/9ca114d141bf0c8cdf949b10b7396653d649de6e
fix issue 11431 - std.file.slurp fails with Windows newlines

https://github.com/dlang/phobos/commit/f4c6d5c25e61684594036c2f959d70dcef325365
Merge pull request #6680 from BBasile/issue-11431

fix issue 11431 - std.file.slurp fails with Windows newlines
merged-on-behalf-of: Vladimir Panteleev <github@thecybershadow.net>