🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #2849

Re: How do I flush disk buffer?

#2849
From: David Charlap
Date: Tue, 15 Dec 1992 01:54
22 lines
1549 bytes
In article <92349.025025DLVGC@CUNYVM.BITNET> DLVGC@CUNYVM.BITNET (Dimitri Vulis) writes:
>I've had a similar problem (keeping the log file in the event the power
>goes off) and simply calling fflush(fptr) after every fprintf seems to
>commit the data to disk right away. (Including writing over a LAN Server
>to a networked disk).  I even wrote a little function wrlog using stdargs
>that first passes its args to fprintf(logfptr, then fflush(logfpr)'s.
>
>Of course, fflush _may_ work differently under gcc (I tried this with
>both icc and ms c 6.0)

If you use OS/2 calls (like DosOpen, DosWrite, DosClose) instead of C
library calls (like fopen, fwrite, fclose), you'll notice an option on
DosOpen which tells the system not to cache the file handle.  This may
do what you want it to.



-- 
  |)  David Charlap          | .signature confiscated by FBI due to
 /|_  dic5340@hertz.njit.edu | an ongoing investigation into the
((|,)                        | source of these .signature virusses
 ~|~
Technical Details
Message-ID: <1992Dec15.015458.15556@njitgw.njit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
References: <1992Dec3.012008.27192@networx.com> <92349.025025DLVGC@CUNYVM.BITNET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
From: dic5340@hertz.njit.edu (David Charlap)
Newsgroups: comp.os.os2.programmer
Subject: Re: How do I flush disk buffer?
Message-ID: <1992Dec15.015458.15556@njitgw.njit.edu>
Date: 15 Dec 92 01:54:58 GMT
References: <1992Dec3.012008.27192@networx.com> <92349.025025DLVGC@CUNYVM.BITNET>
Sender: news@njit.edu
Organization: New Jersey Institute of Technology, Newark, N.J.
Lines: 22
Nntp-Posting-Host: hertz.njit.edu