Path: utzoo!attcan!telly!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!ncar!midway!valley From: valley@uchicago (Doug Dougherty) Newsgroups: comp.os.msdos.programmer Subject: Re: Turbo C++ fopen() & fflush() Message-ID: Date: 26 Nov 90 16:31:35 GMT References: <1778@mts.ucs.UAlberta.CA> <1020@marvin.moncam.co.uk> Sender: news@midway.uchicago.edu (News Administrator) Organization: University of Chicago Lines: 28 emmo@moncam.co.uk (Dave Emmerson) writes: >Heh, I got burned by that one too. >Problem is, fflush doesn't flush the DOS buffers to disk, so >you need to do : >FILE *stream ; >int fhandle ; >.... >fflush(stream) ; >fhandle = dup(fileno(stream)) ; >close(fhandle) ; >.... >Its messy, but it'll fix it for you. Note that stream remains >open, but the buffers have been flushed, and the FAT updated. >ATB, >Dave E. Incidentally, there is a "Commit File" system call in DOS 3.3+ Supposed to be the bestest, fastest way to do it.