home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / alt / msdos / programm / 2284 < prev    next >
Encoding:
Text File  |  1992-08-29  |  1.9 KB  |  47 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!stanford.edu!hubcap!ncrcae!ncratl!scscom!awd
  2. From: awd@atl.scscom.com (Al Degenaar)
  3. Newsgroups: alt.msdos.programmer
  4. Subject: Re: Truncate a file in MS-DOS with Borland C or C++
  5. Message-ID: <1992Aug28.140509.1634@atl.scscom.com>
  6. Date: 28 Aug 92 14:05:09 GMT
  7. References: <172@chorus.chorus.fr> <JPL.92Aug25105414@antares.fct.unl.pt>
  8. Organization: SCS/Compute, Inc.
  9. Lines: 36
  10.  
  11. In <JPL.92Aug25105414@antares.fct.unl.pt> jpl@fct.unl.pt (Joao Prospero Luis [ps]) writes:
  12.  
  13. >In article <172@chorus.chorus.fr> mir@opera.chorus.fr (Adam Mirowski) writes:
  14.  
  15. >>   Trying to make a file restoration utility, I recently noti-
  16. >>   ced that there is no library call in Borland C and C++ to
  17. >>   truncate a file. No truncate() and no ftruncate().
  18. >>
  19.  
  20. Did you try looking at chsize()?  It performs the equivalent function and
  21. has been in borland at least since 2.0, probably longer.
  22.  
  23. >>   Is there a clever trick to do to obtain that? I only need
  24. >>   to change the size within the last cluster range: basically
  25. >>   I want to bring a FILExxxx.CHK to its previous (and separately
  26. >>   saved) name/size/date/time/attributes, etc.
  27.  
  28. >    Do a seek to the location where you want the file truncated
  29. >and write zero bytes.
  30. >    This only works if the call (write, fwrite whatever) really
  31. >does an INT 21h to write zero bytes.
  32.  
  33. This would also work, but why give up portability...
  34.  
  35. >    JPL
  36. >--
  37. >Joao Prospero Luis                | BITNET/Internet: jpl@fct.unl.pt
  38. >Universidade Nova de Lisboa       |            UUCP: jpl@unl.uucp
  39. >FCT - Dpto. de Informatica        | Fax:   (+351) (1) 295-5641
  40. >2825 Monte Caparica, PORTUGAL     | Phone: (+351) (1) 295-4464
  41.  
  42. Al
  43. -- 
  44. Albert W. Degenaar II                               work  : awd@scscom.com
  45. SCS/Compute, Incorporated.                          other : awd@bold1.gatech.edu
  46. #include "standard.disclaimer"                      Phone : (404)368-1040
  47.