# windows opens hdf5 in ASCII mode 

**URL:** <https://forum.hdfgroup.org/t/windows-opens-hdf5-in-ascii-mode/7290>\
**Category:** Hdf-forum archives\
**Created:** [July 16, 2020, 4:04pm UTC](https://forum.hdfgroup.org/t/windows-opens-hdf5-in-ascii-mode/7290 "2020-07-16T16:04:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hdf3](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/h/f0a364/32.png) [@hdf3](https://forum.hdfgroup.org/u/hdf3)\
**Post date:** [July 16, 2020, 4:04pm UTC](https://forum.hdfgroup.org/t/windows-opens-hdf5-in-ascii-mode/7290/1 "2020-07-16T16:04:22Z")

</div>

Hello,  
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.

Regards,  
Rob.

---

<div class="post-metadata">

**Author:** ![hdf3](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/h/f0a364/32.png) [@hdf3](https://forum.hdfgroup.org/u/hdf3)\
**Post date:** [July 19, 2020, 12:13pm UTC](https://forum.hdfgroup.org/t/windows-opens-hdf5-in-ascii-mode/7290/2 "2020-07-19T12:13:02Z")

</div>

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?

Rob.
