windows opens hdf5 in ASCII mode


I have successfully compiled and used hdf5 (v 1.12.0) under Linux.
Compiling under Windows using MinGW also succeeded.
However, it seems that opening a file under Windows is done in ASCII mode instead of binary, causing a mismatch on signature: (hex)
89 48 44 46 0a 00 00 00
instead of:
89 48 44 46 0d 0a 1a 0a

This is exactly what I get if I read the first 8 bytes using open mode “r” instead of mode “rb” in a test program.

File opening is done as follows:
faplist_id = H5Pcreate (H5P_FILE_ACCESS);
file = H5Fopen (fn, H5F_ACC_RDONLY, faplist_id);

I couldn’t find anything in the manuals. I tried to find where/how exactly the file is opened in the source code, but that’s not that easy.
Internet search also doesn’t give a clue (except that mingw isn’t really supported, but hdf5 under mingw IS used).
Any help/hint is appreciated.



Solved this now myself by ORing O_BINARY to o_flags (in H5FDsec2.c). Probably needed at more places.
Something to add this in the official code, in case of non-POSIX?