Line endings when redirecting output to file on windows.

Bastiaan Veelo Bastiaan at Veelo.net
Sun Jun 3 15:24:55 UTC 2018


I need some help understanding where extra '\r' come from when 
output is redirected to file on Windows.

First, this works correctly:
  rdmd --eval="(\"hello\" ~ newline).toFile(\"out.txt\");"
As expected, out.txt contains "hello\r\n".

I would expect the following to do the same, but it doesn't:
  rdmd --eval="write(\"hello\" ~ newline);" > out.txt
Now out.txt contains "hello\r\r\n".

Who is doing the extra conversion here, and how do I stop it?

Thanks!
Bastiaan.


More information about the Digitalmars-d-learn mailing list