Date: Tue, 8 Sep 1998 10:15:04 +0300 (IDT) From: Eli Zaretskii To: Larry Ochoa cc: djgpp AT delorie DOT com Subject: Re: Problem with DJGPP In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.