www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/21/03:15:32

Date: Mon, 21 Apr 1997 10:09:42 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Fred Smith <fredex AT fcshome DOT stoneham DOT ma DOT us>
cc: djgpp AT delorie DOT com
Subject: Re: DJGPP BUG ?
In-Reply-To: <E8txA5.268@fcshome.stoneham.ma.us>
Message-ID: <Pine.SUN.3.91.970421100853.2883E-100000@is>
MIME-Version: 1.0

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

- Raw text -


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