vfs.move-cursor

function

Library: File system utilities (OMVFS)
Import : omvfs.xmd

Declaration
export external function move-cursor
        of      value file file-ref
        by      value integer offset optional
        to      value integer absolute optional

Argument definitions

file-ref
A vfs.file object representing the file in which the cursor is to be moved.
offset
The distance to move the cursor relative its current position.
absolute
The absolute position to move the cursor to.


Purpose

You can use vfs.move-cursor to change the position at which the next read of a file will occur. The position may be specified either relative to the current cursor position, or as an absolute position in a file. For instance, if you know that the data you are interested in starts at byte 100 in a file, you can read from that position like this:

  import "omvfs.xmd" prefixed by vfs.
  
  process
     local vfs.file test-file
     set test-file
      to vfs.open "c:/omnimark/projects/testfile.txt"
     vfs.move-cursor of test-file to 100
     output vfs.reader of test-file

You must specify either a relative or absolute movement, and not both.

Exceptions

The following exceptions may occur: