function
Library: File system utilities (OMVFS)
Import : omvfs.xmd |
export external function truncate value file file-ref at value integer absolute optional
Argument definitions
You can use vfs.truncate
to truncate a file. The following program will truncate the specified file after the 5th byte:
import "omvfs.xmd" prefixed by vfs. process local vfs.file too-long set too-long to vfs.open "c:\temp\test.txt" for vfs.read-write-mode vfs.truncate too-long at 5
This function will always leave the file with a number of bytes equal to the specified value. To empty a file, specifiy a value of 0 or vfs.start-offset
. If the value specified is greater than the current size of the file, the file will be padded with null bytes up to the specified length.
If you do not specify the absolute position at which to truncate the file, it will be truncated at the current position. You can determine the current cursor position with vfs.cursor-position
.
The following exceptions may occur: