Bug in 4.3/4.2 stdio with "w+"?

bnfb at uw-beaver.UUCP bnfb at uw-beaver.UUCP
Sat Oct 11 05:56:29 AEST 1986


This program worked under 4.2bsd but not under 4.3bsd.  If you change the
"w+" to "w", it works.  Or if you use "a" instead of "a+".

The program:

#include <stdio.h>
main()
{
    FILE* pF;
    long l;

    pF = fopen("TEMP","w+");
    fputs( "AAAAA\n", pF );
    l = ftell( pF );
    fputs( "BBBBB\n", pF );
    fseek( pF, l, 0 );
    fputs( "CC", pF );
    fclose( pF );
}

Under 4.2 it produces:		Under 4.3 it produces:

AAAAA				AAAAA
CCBBB				BBBBB

Is this a real bug or am I just lost?

					Bjorn



More information about the Comp.unix mailing list