In version 3.2 of Mingw-runtime, inlined versions of getc
and putc were introduced. It seems that the character
to be read or written should be typecast to an unsigned
char (or bitwise ANDed with 0xFF). Otherwise, weird
results may be obtained. E.g. Hp2xx completely breaks
down on binary plot files.