FileSeek – PB Docs 150

FileSeek PowerScript function

Description

Moves the file pointer to the specified position in a file
whose size does not exceed 2GB. The file pointer is the position
in the file at which the next read or write begins.

Syntax

Argument

Description

file#

The integer assigned to the file when
it was opened.

position

A long whose value is the new position
of the file pointer relative to the position specified in origin,
in bytes.

origin

The value of the SeekType enumerated
datatype specifying where you want to start the seek. Values are:

  • FromBeginning! – (Default)
    At the beginning of the file

  • FromCurrent! – At the current position

  • FromEnd! – At the end of the file

Return Values

Long. Returns the file position after
the seek operation has been performed. If any argument’s
value is null, FileSeek returns null.

Usage

Use FileSeek to move within a binary file
that you have opened in stream mode. FileSeek positions
the file pointer so that the next FileReadEx or FileWriteEx occurs
at that position within the file.

If origin is set to FromBeginning!, and
the file is not opened in stream mode, the byte-order mark is ignored
automatically. For example, suppose the file’s hexadecimal
display is FF FE 54 00 68 00 69 00 73 00,
the following example illustrates the behavior:

The FileSeek function cannot handle files
whose size exceeds 2GB. Use FileSeek64 to move
the file pointer in larger files.

Examples

This example positions the file pointer 14 bytes
from the end of the file:

This example moves the file pointer from its current
position 14 bytes toward the end of the file. In this case, if no
processing has occurred after FileOpen to affect
the file pointer, specifying FromCurrent! is the same as specifying FromBeginning!:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x