delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/06/28/12:09:00

Date: Sun, 28 Jun 1998 12:08:33 -0400 (EDT)
Message-Id: <199806281608.MAA23848@delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
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

>   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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019