delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/08/03:17:28

Date: Tue, 8 Sep 1998 10:15:04 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Larry Ochoa <l8a AT swbell DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Problem with DJGPP
In-Reply-To: <MPG.105e4129bf125abf989680@news.swbell.net>
Message-ID: <Pine.SUN.3.91.980908101445.26824F-100000@is>
MIME-Version: 1.0

On Mon, 7 Sep 1998, Larry Ochoa wrote:

>     for(i=1;i<=100;i++) {
>       fprintf(file,"%d\n",i);
>       fgets(blah, 5, file);
>       printf("%s\n", blah);

ANSI C specifies that you must call either fflush or fseek after
output to and before input from the same stream, and you must call
fseek after input and before output.  Otherwise, you are disrupting
the buffering machinery of the stdio functions and get garbage.

- Raw text -


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