Append mode ("a") query
Zev Sero
zvs at bby.oz.au
Fri Feb 16 10:06:26 AEST 1990
In a previous article chet at uwovax.uwo.ca writes:
I know I'll be embarrassed because of this, but would someone please
tell me why program A below, when executed twice contains twenty lines
(i.e. the 2nd ten lines are inserted before the EOF mark), but program B
positions its appends after the EOF mark (so that they don't appear when
the file is typed out)? And what I can do to fix B. This happens on
Turbo C and Small C (2.2), and I presume on every C compiler.
[followed by example program A which works, and B which doesn't, even
though the relevant code looks identical].
and in article <4992.25d9633c at uwovax.uwo.ca> he writes:
In message 14089 I noted a problem with the "a" mode. This is to confirm
that the C compiler on the Unix OS I use (Sun 4.0.1_Export) behaves the
same way.
Huh? In UNIX there is no such thing as an EOF marker, so how could
"a" append after the EOF? I had assumed that your problem only
happened in DOS.
In any case, I compiled your program B with both gcc and cc under
SunOS Release 4.0.3_EXPORT and also under Sun UNIX 4.2 Release
3.5EXPORT and it works fine in all four versions.
--
Zev Sero - zvs at bby.oz.au
Megalomaniacs are simply people who know damn well they can run the universe
better then God or the present governors. - Abner Doon (Orson S. Card)
More information about the Comp.lang.c
mailing list