File.write write extra CR character if a string has CRLF on windows

Pham via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 6 08:00:00 PDT 2016


string s is multi-lines (CRLF as line break)
The write function will write extra CR character for each CRLF 
pair -> why (bug?)

import std.file;
import std.stdio;

string s = ...;

auto fHandle = File("f:\\text.txt", "w"); // open for writing
fHandle.write(s);
fHandle.close();


More information about the Digitalmars-d-learn mailing list