Mail Archives: djgpp/1996/12/21/13:42:49
Roland Nilsson wrote:
>
> Yes, I'm parsing binary files. I believe C FILE i/o is always in raw
> mode. The only fopen() flags available are those relating to i/o
> direction and overwrite, according to my djgpp function list.
> I usually fopen() with "r".
Have you read a C book lately? "r" opens files in TEXT mode. For
binary operations, use "rb", "wb", "r+b", "w+b", etc. This is almost
certain to be the cause of your problem.
Have you even tried reading the libc docs??? I just looked in the
fopen() docs and saw an explicit description of the mode string and what
the values mean, including a clear mention of text and binary modes.
RTFM!
--
John M. Aldrich <fighteer AT cs DOT com>
* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
again.
* It doesn't necessarily do it in chronological order, though.
--- Douglas Adams
- Raw text -