TRUNCATE_LUN
Syntax | Arguments | Keywords | Examples | Version History | See Also
The TRUNCATE_LUN procedure truncates the contents of a file (which must be open for write access) at the current position of the file pointer. After this operation, all data before the current file pointer remains intact, and all data following the file pointer are gone. The position of the current file pointer is not altered.
Syntax
TRUNCATE_LUN, Unit1, ..., Unitn
Arguments
Unitn
Scalar or array variables containing the logical file unit numbers of the open files to be truncated.
Keywords
None.
Examples
Example 1
Truncate the entire contents of an existing file:
Example 2
Given an existing file of 10,000 bytes, throw away the final 5,000 bytes, and then write an additional 2,000 byte array in their place. The resulting file will be 7,000 bytes in length.
OPENU, unit, 'mydata.dat', /GET_LUN POINT_LUN, unit, 5000 TRUNCATE_LUN, unit WRITEU, unit, BYTARR(2000) FREE_LUN, unit
Version History
See Also
GET_LUN, OPENR/OPENU/OPENW, POINT_LUN