home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / basic / bmag / filetrun.bas < prev    next >
Encoding:
BASIC Source File  |  1994-04-26  |  886 b   |  26 lines

  1. '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
  2. '  Msg#: 382                                          Date: 15 Apr 94  10:27:30
  3. '  From: Matt Hart                                    Read: Yes    Replied: No 
  4. '    To: Michael Jones                                Mark:                     
  5. '  Subj: File Truncation
  6. '──────────────────────────────────────────────────────────────────────────────
  7. 'MJ>Some time ago there was a post of a simple way to truncate
  8. 'MJ>a file to a certain size.
  9.  
  10. 'There's an interrupt call to truncate a file:
  11.  
  12. '$INCLUDE:'QB.BI'
  13.  
  14. SUB Truncate(File$, NewSize&)
  15.     F = FREEFILE
  16.     OPEN File$ FOR BINARY AS F
  17.     SEEK #F, NewSize&+1
  18.     DIM InRegs AS RegTypeX
  19.     DIM OutRegs AS RegTypeX
  20.     InRegs.AX = &H4000
  21.     InRegs.BX = FILEATTR(F,2)
  22.     CALL INTERRUPTX(&H21, InRegs, OutRegs)
  23.     CLOSE F
  24. END SUB
  25.  
  26.