Extra Carriage Returns using write

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 2 08:11:03 PDT 2014


On Mon, 02 Jun 2014 10:36:17 -0400, Dave G <dgregory00 at gmail.com> wrote:

> On Monday, 2 June 2014 at 14:27:45 UTC, Steven Schveighoffer wrote:
>> On Mon, 02 Jun 2014 10:14:11 -0400, Dave G <dgregory00 at gmail.com> wrote:
>>
>>> 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
>>
>> The bug is in DMC's C runtime, to which Windows DMD defers for file I/O.
>>
>> Also note, File is a Ref-counted struct. You do not need to 'new' it:
>>
>> auto outf = File("out.txt", "wb");
>>
>> -Steve
>
> Ok, Thanks Steve. Is that something that is going to be fixed?

You would have to ask Walter. Probably the best place is to ask on the DMC  
forums.

See here: http://digitalmars.com/NewsGroup.html

-Steve


More information about the Digitalmars-d mailing list