home *** CD-ROM | disk | FTP | other *** search
- '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
- ' Msg#: 382 Date: 15 Apr 94 10:27:30
- ' From: Matt Hart Read: Yes Replied: No
- ' To: Michael Jones Mark:
- ' Subj: File Truncation
- '──────────────────────────────────────────────────────────────────────────────
- 'MJ>Some time ago there was a post of a simple way to truncate
- 'MJ>a file to a certain size.
-
- 'There's an interrupt call to truncate a file:
-
- '$INCLUDE:'QB.BI'
-
- SUB Truncate(File$, NewSize&)
- F = FREEFILE
- OPEN File$ FOR BINARY AS F
- SEEK #F, NewSize&+1
- DIM InRegs AS RegTypeX
- DIM OutRegs AS RegTypeX
- InRegs.AX = &H4000
- InRegs.BX = FILEATTR(F,2)
- CALL INTERRUPTX(&H21, InRegs, OutRegs)
- CLOSE F
- END SUB
-
-