Date: Mon, 21 Apr 1997 10:09:42 +0300 (IDT) From: Eli Zaretskii To: Fred Smith cc: djgpp AT delorie DOT com Subject: Re: DJGPP BUG ? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Fri, 18 Apr 1997, Fred Smith wrote: > Try doing: > > fflush (fp); > > BEFORE the filelength call. AFAIK, this is incorrect. A call to `fflush' indeed flushes buffers, but it doesn't force DOS to update the file's directory entry (which includes the size). That's because `fflush' only flushes the DJGPP's buffers; DOS also buffers file I/O, even if you don't have a disk cache, and those buffers internal to DOS aren't flushed. A call to `fsync' is required to update the file on disk and its directory entry, if closing the file is undesirable. But the easiest solution (IMHO) is just to use `fseek'.