[Mingw-w64-public] getc skips "0D" in binary file

2021-11-30 Thread David Webb
Stephen and Mateuz. Many thanks for your quick replies. I changed the mode to 'rb' and the first set of files are now read without error. I've also found that the GNU routine fread() is Posix compliant and ignores the 'b' so the same code works on both machines and I do not need to add any

Re: [Mingw-w64-public] getc skips "0D" in binary file

2021-11-30 Thread Mateusz
setmode(fileno(stdin), O_BINARY); Regards Mateusz W dniu 30.11.2021 o 11:11, David Webb pisze: Sorry if this is old hat - an archives search showed there may have been some discussion of getc and 0D but the query returned 9770 messages and I gave up after the first few hundred. A C linux

Re: [Mingw-w64-public] getc skips "0D" in binary file

2021-11-30 Thread Stephen Kitt
Le 30/11/2021 11:11, David Webb a écrit : [...] Looking at stdio.h, it looks as if mingw uses a getc routine instead of the normal macro. Is this correct - is it for example using a Microsoft getc routine which drops '0D' from '0D''0A'? More importantly, is there a way to prevent the '0D'

[Mingw-w64-public] getc skips "0D" in binary file

2021-11-30 Thread David Webb
Sorry if this is old hat - an archives search showed there may have been some discussion of getc and 0D but the query returned 9770 messages and I gave up after the first few hundred. A C linux program I am converting needs to read a large number of binary files containing a mixture of