Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.questions Subject: Re: fopen ( ..., "a" ) --- how does the "a" work? Message-ID: <11774@smoke.BRL.MIL> Date: 8 Dec 89 02:47:51 GMT References: <3250@hub.UUCP> <895@hsi86.hsi.UUCP> <21152@mimsy.umd.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 19 In article <21152@mimsy.umd.edu> chris@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.