Date: Sun, 28 Jun 1998 12:08:33 -0400 (EDT) Message-Id: <199806281608.MAA23848@delorie.com> From: DJ Delorie To: robert DOT hoehne AT gmx DOT net CC: djgpp-workers AT delorie DOT com In-reply-to: <35940E1D.102CEB7@gmx.net> (message from Robert Hoehne on Fri, 26 Jun 1998 21:09:49 +0000) Subject: Re: Bug in fwrite Precedence: bulk > fread(&i, sizeof(i), 1, f); > /* now the buffer is newly allocated because it was > reset after the last fseek and because of the read, > in the _flag (member of FILE) is the last operation > set to read */ > i = -1; > fwrite(&i, sizeof(i), 1, f); Are you allowed to follow a fread with an fwrite without a seek or flush inbetween? The ANSI spec says you must call fseek, fflush, fsetpos, or rewind between read and write operations on the same stream.