The compiled Windows version using MinGW would ignore the 'r+b' file mode and open the file using text mode not binary. This would convert any 0x0a codes to Windows CR, LF codes. I'm now setting _fmode to O_BINARY in bfcntl and it seems correct.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The compiled Windows version using MinGW would ignore the 'r+b' file mode and open the file using text mode not binary. This would convert any 0x0a codes to Windows CR, LF codes. I'm now setting _fmode to O_BINARY in bfcntl and it seems correct.