Declaration define external function vfsMoveCursor
value vfsFile file
by value integer offset
or
define external function vfsMoveCursor
value vfsFile file
to value integer absolute
Argument definitions
- file
- is the vfsFile object for the file in which the cursor is to be moved.
- offset
- is a relative cursor movement distance.
- absolute
- is an absolute cursor movement distance.
Purpose
Use vfsMoveCursor to change the cursor position from the current location in a file's contents to the position you specify.
Requirements
You must include the following line at the beginning of your OmniMark program:
include "omvfs.xin"
file must:
- be open (else external exception VFS200)
- not be currently read from or written to (else external exception VFS204)
offset
- may not be specified if absolute is specified (else external exception VFS210)
- positions the cursor relative to the current cursor position
- must not position the cursor before the start of the file (else external exception VFS211)
- may position the cursor after the current end of the file
- positions the cursor towards the start of the file when it has a negative value
- positions the cursor towards the end of the file when it has a positive value
- leaves the cursor where it is when it has a value of zero (0)
absolute
- may not be specified if offset is specified (else external exception VFS210)
- positions the cursor relative to the start of the file
- may position the cursor after the current end of the file
- positions the cursor at the start of the file when it has a value of zero (0)
- positions the cursor at the start of the file when it has a value of VFS-START
- positions the cursor at the end of the file when it has a value of VFS-END
- positions the cursor at the specified byte when it has a positive value
Specifying any other value for absolute will cause an exception to be thrown (external exception VFS209).
Usage Notes
If neither absolute or offset is specified, external exception VFS210 is thrown.
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
Move the cursor to the 200th position in the text, then move the cursor to the 210th position in the text, and finally output the text from position 210 to the end. The cursor finishes at the end of the file.
include "omvfs.xin"
process
local vfsFile Cairo
. . .
set Cairo to vfsOpen "cairo-doc.txt" for vfs-read
. . .
vfsMoveCursor Cairo to 200
vfsMoveCursor Cairo by 10
output "Contents after position 210: " || vfsRead Cairo || "%n"
OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:46:05 pm
If you have any comments about this section of the documentation, send email to [email protected]
Copyright © Stilo Corporation, 1988-2005.