[Issue 4555] New: Double newlines with std.file.readText

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 1 14:10:53 PDT 2010


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

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


--- Comment #0 from bearophile_hugs at eml.cc 2010-08-01 14:10:49 PDT ---
This is a D2 program:


import std.file: readText;
import std.stdio: write;
void main() {
    string s = readText("test.d");
    write(s);
}


With DMD 2.047 on a 32 bit Windows Vista Home this D2 program prints all
newlines doubled (assuming the program is named "test.d"):

import std.file: readText;

import std.stdio: write;

void main() {

    string s = readText("test.d");

    write(s);

}


Saving the same source code with in UNIX style the doubling of newlines doesn't
happen.
One or two testers have not found this problem on Windows XP.


This program:

import std.file: readText;
import std.stdio: write;
void main() {
    string s = readText("bug15.d");
    foreach (c; s[0 .. 35])
        write(cast(int)c, " ");
}


Prints:
105 109 112 111 114 116 32 115 116 100 46 102 105 108 101 58 32 114 101 97 100
84 101 120 116 59 13 10 105 109 112 111 114 116 32 

Note the normal sequence of the newline of the first line plus the "i" char at
the start of the second line:
13 10 105

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


More information about the Digitalmars-d-bugs mailing list