swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Other Library Functions  
function  

vfsTruncate

 
 

Library: File system utilities (OMVFS legacy)
Include: omvfs.xin

Declaration

define external function vfsTruncate 
         value  vfsFile  file
     at  value  integer  absolute  optional

Argument definitions

file
is the vfsFile object associated with the file to be truncated.
absolute
is the first byte to be deleted.


Purpose

Use vfsTruncate to truncate a file at a specified byte.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "omvfs.xin"

file must be:

absolute deletes file contents beginning with:

Specifying any other value for absolute will cause an exception to be thrown (external exception VFS209). All bytes from and including the specified position to the end of the file will be removed from the file.

Usage Notes

If absolute isn't supplied, then it defaults to the current cursor position.

If absolute is greater than the current file size, then the file size in increased to absolute and the new file contents are undefined.

External exception VFS300 is thrown for any general OS operation failure. The text accompanying the exception will contain details on the reason for the failure.

Example:

Truncate a file from byte 200 to the end of the file.

  include "omvfs.xin"
  
  process
     local vfsFile vfsFile2
     set vfsFile2 to vfsOpen "myfile.txt" for VFS-READ-WRITE
     vfsTruncate vfsFile2 at 200

      Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.