On Thu, Mar 28, 2024 at 10:10:43PM +0000, jms via Digitalmars-d-learn wrote: > On Thursday, 28 March 2024 at 02:30:11 UTC, jms wrote: [...] > I think I figured it out and the difference is probably in the mode. > This documentation > https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fread?view=msvc-170 > mentions that "If the given stream is opened in text mode, > Windows-style newlines are converted into Unix-style newlines. That > is, carriage return-line feed (CRLF) pairs are replaced by single line > feed (LF) characters." > > And rawRead's documention mentions that "rawRead always reads in > binary mode on Windows.", which I guess should have given me a clue. > chunks must be using text-mode.
It's not so much that chunks is using text-mode, but that you opened the file in text mode. On Windows, if you don't want crlf translation you need to open your file with File(filename, "rb"), not just File(filename "r"), because the latter defaults to text mode. T -- There's light at the end of the tunnel. It's the oncoming train.