Article View: comp.std.c
Article #119Re: does "always append" apply to "a+" mode?
From: Clive Feather
Date: Mon, 10 Aug 1992 10:30
Date: Mon, 10 Aug 1992 10:30
38 lines
2543 bytes
2543 bytes
In article <BsJnKx.5yF@jrd.dec.com> diamond@jit.dec.com (Norman Diamond) writes:
>In article <1992Aug05.081224.17647@x.co.uk> clive@x.co.uk (Clive Feather) writes:
>>>> [In some other article, whose attribution is gone, someone wrote:]
>>>>>> In the section on fopen (4.9.5.3, pp. 130--131), the Standard says:
>>>>>> Opening a file with append mode (|'a'| as the first character in
>>>>>> the |mode| argument) causes all subsequent writes to the file to be
>>>>>> forced to the then current end-of-file, regardless of intervening
>>>>>> calls to the |fseek| function. ...
>> The original quotation is slightly wrong: it (section 7.9.5.3 "fopen")
>> actually says:
>>| Opening a file with append mode ('a' as the first character in the
>>| mode argument) causes all subsequent writes to the file to be forced to
>>| the then current end-of-file, regardless of intervening calls to the
>>| lseek function.
> The original version matches the ANSI Dec. 1988 draft, and furthermore ANSI
> doesn't have lseek, so I'm suspicious of this "correction."
The original version also matches the ISO standard. I must have had a
brainstorm. Sorry.
> Are subsequent writes also forced to the current end-of-file regardless of
> intervening calls to the fsetpos function and the rewind function? Or do
> they not get forced in those situations, in which Chris Torek's reported
> observations were of correct implementations? Or does the result become
> undefined (due to not being specified as unspecified or any other less
> serious alternative to undefined)?
They are written to the end of the stream - I covered this in the cited
posting. *I* interpret the standard as requiring each buffer-full (see
setvbuf) to be written to the current EOF - provided that the underlying
system can do it at all - but you may have a different opinion.
--
Clive D.W. Feather | IXI Limited | If you lie to the compiler,
clive@x.co.uk | 62-74 Burleigh St. | it will get its revenge.
Phone: +44 223 462 131 | Cambridge CB1 1OJ | - Henry Spencer
Fax: +44 223 462 132 | United Kingdom |
Technical Details
Message-ID:
<1992Aug10.103048.7171@x.co.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!acorn!ixi!cliveReferences:
<13905@goanna.cs.rmit.oz.au> <1992Aug05.081224.17647@x.co.uk> <BsJnKx.5yF@jrd.dec.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!acorn!ixi!clive From: clive@x.co.uk (Clive Feather) Newsgroups: comp.std.c Subject: Re: does "always append" apply to "a+" mode? Message-ID: <1992Aug10.103048.7171@x.co.uk> Date: 10 Aug 92 10:30:48 GMT References: <13905@goanna.cs.rmit.oz.au> <1992Aug05.081224.17647@x.co.uk> <BsJnKx.5yF@jrd.dec.com> Organization: IXI Limited, Cambridge, UK Lines: 38