Seek

Moves the pointer to the specified position in an OLEStream object or in a file that you open using the FileDirect object.

To move the pointer in

Use

an OLEStream object

Syntax 1 For OLEStream objects

a file opened by the FileDirect object

Syntax 2 For FileDirect objects


Syntax 1 For OLEStream objects

Description

Moves the read/write pointer to the specified position in an OLE stream object. The pointer is the position in the stream at which the next read or write begins.

Applies to

OLEStream objects

Syntax

olestream.Seek ( position {, origin } )

Returns

Integer. Returns 0 if it succeeds and a negative number if an error occurs.


Syntax 2 For FileDirect objects

Description

Moves the pointer in a file that you open with the FileDirect object.

Applies to

FileDirect objects

Syntax

instancename.Seek (distanceToMove, mode)

Argument

Description

instancename

Instance name of the FileDirect object

distanceToMove

Long for the number of bytes by which you want to move the file pointer. You move the pointer from the position specified by the mode argument

mode

Enumerated value of type seektype. Values can be:

  • frombeginning! Move the pointer from the file beginning

  • fromcurrent! Move the pointer from the current position

  • fromend! Move the pointer from the end of the file

Returns

Integer. Returns 1 for success and a negative number for an error.

Usage

Use the Seek function to place the file pointer at a specified position before you begin to read from or write to the file.

Examples

Example 1

The following script moves the file pointer 100 bytes from the file end before the Read function is called:

li_ret = nvo_FileDirect.seek ( 100, fromend!)
li_ret = nvo_FileDirect.read ( lb_data, 100, li_amount)

See also