A question about ANSI C file handling

Doug Gwyn gwyn at brl-smoke.ARPA
Sat Mar 19 11:14:56 AEST 1988


In article <12385 at brl-adm.ARPA> ath at my.cvab.SE (Anders Thulin) writes:
>Does anybody know if there is a way (in ANSI C) to determine whether
>a file is binary or not?

There can't be, because some systems do not maintain anything in the
file system that says whether a file is to be considered binary or not.
For example, UNIX.

>Does fopen fail if a binary file isn't opened as binary?

It is allowed to, but not required to (for the same reason as above).

In other words, it is up to the application to use the right mode.



More information about the Comp.lang.c mailing list