Extra Carriage Returns using write

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 3 06:17:07 PDT 2014


On Tue, 03 Jun 2014 07:34:35 -0400, Marco Leise <Marco.Leise at gmx.de> wrote:

> Am Mon, 02 Jun 2014 14:14:11 +0000
> schrieb "Dave G" <dgregory00 at gmail.com>:
>
>> Hello,
>>
>> Why does the following add an extra CR in front of the CRLF's
>>
>> auto outf = new File("out.txt", "w");
>> outf.write("this\r\nis\r\na\r\ntest");
>> outf.close;
>>
>> If I make the file binary
>> auto outf = new File("out.txt", "wb");
>>
>> it works as expected.
>>
>> I am using 2.065 and windows 7
>>
>> Thanks,
>> Dave G
>
> Redirection of D's I/O through the C runtime needs to be killed
> with fire. It inherits C's flaws like the various vendor
> specific extensions to the mode string for important flags like
> inheritance of file handles in child processes.

I'm working on it. There are so many reasons to remove it. Of course, it  
will still have to be the default.

-Steve


More information about the Digitalmars-d mailing list