/
setFilePos

setFilePos

Description

Sets the current file position.

Use this command to set your position in a file. The value is in bytes from the origin, which you specify in the origin argument. The file position can be set past the end of the file in Write mode.

This command only makes sense in files opened in binary mode.

Functional area

Disk I/O

Command syntax

Syntax

setFilePos fileID offset [-cur] [-end]

Arguments

NameTypeRequiredComments
originstring
Origin that the offset is defined against, either beg for the beginning of the file, cur for the current file position, or end for the end of the file.
offsetint
Offset in bytes from the origin to set the file position to
fileIDint
ID of file previously opened with fileOpen

Flags

NameFlag argumentsArgument typeExclusive toComments
cur0end
end0cur

Return value

void

Examples

int $fileID;
int $filePos;
$fileID = `fileOpen "C:/testfile.log" "r"`;
 
// Read a value from the file, which "points" to another part of the
// file. This could be done in a file "header" section
$filePos = `readInt $fileID`;
print $filePos;
 
// Move to the file position "pointed" to earlier, so we can do some
// reading
setFilePos $fileID $filePos;

Additional information

Related commands


© Copyright Vicon Motion Systems. All rights reserved.

Vicon trademarks