Doubled newlines
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sat Jul 31 20:10:05 PDT 2010
Oh and I'm getting the same issue in Python when using CR only. I don't know why I have the CR option in the text editor if it doesn't work properly. I guess CR is used on the Macs maybe..?
Andrej Mitrovic Wrote:
> 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