Extra Carriage Returns using write

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 3 04:34:35 PDT 2014


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.

-- 
Marco



More information about the Digitalmars-d mailing list