On Wednesday, 28 September 2016 at 16:53:24 UTC, Vladimir Panteleev wrote:
On Wednesday, 28 September 2016 at 06:52:51 UTC, Andre Pany wrote:

Since the file is opened in text mode (which is the default), the C runtime automatically translates the single \n to a \r\n pair when writing the file. Since std.ascii.newline is defined to be "\r\n" on Windows, it ends up being written as "\r\r\n".

You could either open the file in binary mode (use "wb" as the second argument), or always use "\n" for line separators.

Thank you so much, I was already getting crazy about this. I just checked whether this information is included in library documentation for std.stdio. If I havent't miss s.th. this isn't mentioned directly but only as a side information in this sentence: Use std.ascii.newline for portability (unless the file was opened in text mode).

I will create a bug report, for users without C knowledge, this is a trap:)

Kind regards
André

Reply via email to