Fileseek function – Multichannel Systems NeuroExplorer User Manual

Page 159

Advertising
background image

5.5.1.17. FileSeek Function

FileSeek Function


Repositions file pointer by the specified offset.

Syntax


double FileSeek(fileID, offset, type)

Parameters

Parameter

Type

Description

fileID

double

File ID received from OpenFile function.

offset

double

Number of bytes to move the file pointer.

type

string

Pointer movement mode. Should be "begin",
"current" or "end".

Returns


The new byte offset from the beginning of the file.

Comments


FileSeek(file,0,"end") returns file size in bytes. FileSeek(file,0,"current") returns current file position.

Usage

NexScript

% open binary file in read mode

file = OpenFile("C:\binaryfile.dat", "r")

% get file length

fileLength = FileSeek(file, 0, "end")

% move pointer 4 bytes from the beginning of the file

newPosition = FileSeek(file, 4, "begin")

See Also

Introduction to NexScript Programming

NexScript Function Categories

Page 157

Advertising