SeekBytes

InstallShield 2020 » InstallScript Language Reference

The SeekBytes function repositions the file pointer within an open binary file. You can move the file pointer a specific number of bytes relative to its current position or relative to the beginning or end of the file.

Note:Before calling SeekBytes, you must open the file (which can be a file on the Internet) in binary mode by calling OpenFileMode and OpenFile. When you are finished writing bytes to the file, call CloseFile to close the file.

Syntax

SeekBytes ( nFileHandle, nBytes, nPosition );

Parameters

SeekBytes Parameters

Parameter

Description

nFileHandle

Specifies the file handle of a file that has been opened in binary mode.

nBytes

Specifies the number of bytes to move the file pointer relative to the position specified by nPosition. If nBytes is a positive number, the file pointer is moved toward the end of the file. If nBytes is a negative number, the file pointer is moved toward the beginning of the file.

nPosition

Specifies the location in the file from which to move the pointer nBytes. Pass one of the following predefined constants in this parameter:

FILE_BIN_CUR—Moves the pointer nBytes from its current position.
FILE_BIN_END—Moves the pointer nBytes from the end of the file.
FILE_BIN_START—Moves the pointer nBytes from the beginning of the file.

Return Values

SeekBytes Return Values

Return Value

Description

0

Indicates that the function successfully repositioned the pointer.

< 0

Indicates that the function was unable to reposition the pointer.

See Also