Doubled newlines
    Andrej Mitrovic 
    andrej.mitrovich at gmail.com
       
    Sat Jul 31 20:06:28 PDT 2010
    
    
  
I'm getting normal newlines here (XP):
C:\output>test.exe
import std.file: readText;
import std.stdio: write;
void main() {
    string s = readText("test.d");
    write(s);
}
The text used CR+LF newlines. I also tried them using LF newlines, which worked fine. But I've then tried with CR and that gives out weird output like so:
}   write(s);= readText("test.d");
bearophile Wrote:
> I think there is a bug here, but can you please try it a bit?
> The name of this program is "test.d", so it loads its souce code:
> 
> import std.file: readText;
> import std.stdio: write;
> void main() {
>     string s = readText("test.d");
>     write(s);
> }
> 
> 
> On windows the output is:
> import std.file: readText;
> 
> import std.stdio: write;
> 
> void main() {
> 
>     string s = readText("test.d");
> 
>     write(s);
> 
> }
> 
> 
> So it shows extra newlines (on Windows newlines are two chars).
> 
> On Windows a similar Python program doesn't show the doubled newlines:
> s = open("test.d").read()
> print s
> 
> Bye,
> bearophile
    
    
More information about the Digitalmars-d-learn
mailing list