Append mode ("a") query

chet at uwovax.uwo.ca chet at uwovax.uwo.ca
Thu Feb 15 05:55:08 AEST 1990


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. A (stupid) way around the problem is to open the file with
"r+" and then read to EOF before executing the fprintf() statement:

(to be inserted into program B:)

	while (!feof(fp))
		fgets(dump, 240, fp);

If this is done, with the Sun C compiler and with Turbo C (but not with
Small C 2.2), then the EOF mark will be in the proper place.

My questions with respect the different behaviour of A and B still
remain as puzzles. Note also that the first reply to the query involved
a misinterpretation of the code and is not relevant.

Thanks again for any help. Appended below is a bit of lex3.db to show
what B does:

mtu$n.$person$watu$human$
kitu$n.$thing$vitu$entity$
ona$v.$see, look at$psv. onekana$perception$
mtoto$n.$child$watoto$human$
msichana$n.$girl$wasichana$human$
kijana$n.$youth$vijana$human$
chui$n.$leopard, cheetah$chui$animal$

Chet Creider
creider at csd.uwo.ca



More information about the Comp.lang.c mailing list