Mail Archives: djgpp/1994/06/23/02:00:14
> Well, I've learned"
> fopen("b") is ANSI
> open(O_BINARY) is not POSIX...
>
> Recompiling the gnu fileutils, I needed to stick this
> in the fileutils lib (or else have to change every open call
> everywhere or change __fmode in each main...):
>
[ code elided ]
You could also declare a global object thus:
class FModeFixer {
FModeFixer(int m) { _fmode = m; }
};
FModeFixer _fmodefixer(O_BINARY);
which will of course get called before main if you just make
sure it gets linked in by putting it into some essential .o file.
This avoids changing the library.
I used this approach (at DJ's suggestion) to initialize the gppconio
library many moons ago.
--
J. Alan Eldridge (alane AT wozzle DOT linet DOT org)
- Raw text -