fopen ( ..., "a" ) --- how does the "a" work?

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Dec 8 13:47:51 AEST 1989


In article <21152 at mimsy.umd.edu> chris at mimsy.umd.edu (Chris Torek) writes:
>This is scheduled to change (to match the wording in the ANSI standard).
>I also wrote code to assert FAPPEND mode on fdopen(fd, "a").  This is a
>bit nastier, but would seem to be required for reasons of sanity.  I do
>not, however, clear FAPPEND on other fdopen calls.
>What does SysV do?  What does the SVID say?

All the System V documentation and sources I could find, including SVID
Issue 2, indicate that the proper open() modes were the responsibility
of the invoker of fdopen(), not of the fdopen() implementation.

IEEE Std 1003.1 is a bit more explicit in its description of fdopen():
"The type of the stream must be allowed by the mode of the open file".
To me this indicates clearly that the System V implementation is proper.

In fact, I think it is a disservice for some other (4.nBSD?)
implementation to add functionality such as you describe.  That
could mislead programmers on such systems into thinking that that
implementation's behavior was universal, whereas it is not.



More information about the Comp.unix.questions mailing list