home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / os2 / programm / 7020 < prev    next >
Encoding:
Internet Message Format  |  1992-12-14  |  1.5 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
  2. From: dic5340@hertz.njit.edu (David Charlap)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: Re: How do I flush disk buffer?
  5. Message-ID: <1992Dec15.015458.15556@njitgw.njit.edu>
  6. Date: 15 Dec 92 01:54:58 GMT
  7. References: <1992Dec3.012008.27192@networx.com> <92349.025025DLVGC@CUNYVM.BITNET>
  8. Sender: news@njit.edu
  9. Organization: New Jersey Institute of Technology, Newark, N.J.
  10. Lines: 22
  11. Nntp-Posting-Host: hertz.njit.edu
  12.  
  13. In article <92349.025025DLVGC@CUNYVM.BITNET> DLVGC@CUNYVM.BITNET (Dimitri Vulis) writes:
  14. >I've had a similar problem (keeping the log file in the event the power
  15. >goes off) and simply calling fflush(fptr) after every fprintf seems to
  16. >commit the data to disk right away. (Including writing over a LAN Server
  17. >to a networked disk).  I even wrote a little function wrlog using stdargs
  18. >that first passes its args to fprintf(logfptr, then fflush(logfpr)'s.
  19. >
  20. >Of course, fflush _may_ work differently under gcc (I tried this with
  21. >both icc and ms c 6.0)
  22.  
  23. If you use OS/2 calls (like DosOpen, DosWrite, DosClose) instead of C
  24. library calls (like fopen, fwrite, fclose), you'll notice an option on
  25. DosOpen which tells the system not to cache the file handle.  This may
  26. do what you want it to.
  27.  
  28.  
  29.  
  30. -- 
  31.   |)  David Charlap          | .signature confiscated by FBI due to
  32.  /|_  dic5340@hertz.njit.edu | an ongoing investigation into the
  33. ((|,)                        | source of these .signature virusses
  34.  ~|~
  35.