File.write introduces \r regardless of presence

Steven Schveighoffer schveiguy at gmail.com
Sun Jul 17 13:10:58 UTC 2022


On Saturday, 16 July 2022 at 20:46:00 UTC, HuskyNator wrote:
is raises 3 questions for me.
> 1. Are there any nasty pitfalls with this change that might 
> force me to find a workaround? (eg. en/decoding issues or the 
> like?)

This is strictly a C mechanism, and only on Windows. So refer to 
the C documentation on said pitfalls.

>
> 2. Does this mean readText reads in binary mode?

readText comes from std.file, and basically just reads a file 
into an array of char[] instead of an array of ubyte[]. It does 
no translation for line endings. It does validate the text is 
valid utf and makes sure the BOM is correct.

>
> 3. The documentation refers to `the same semantics as in the C 
> standard library fopen function`, would this also include the 
> "x" subspecifier in C2011?

D directly calls fopen from C, so I would imagine this is true if 
you use a C library that has the subspecifier.

-Steve


More information about the Digitalmars-d-learn mailing list