WriteBytes

InstallShield 2020 ยป InstallScript Language Reference

The WriteBytes function writes a specific number of bytes to a file opened in the binary mode. This function starts writing bytes at the current file pointer location.

Note:Before calling WriteBytes, you must open the file by calling OpenFileMode(FILE_MODE_BINARY) and then calling OpenFile.

The parameter nIndex is an index into svString; nBytes specifies how many bytes beyond the value of nIndex you want to write to the file. If nIndex plus nBytes exceeds the length of svString, InstallShield writes only the number of bytes from the index into the string to the end of the string. For example, if svString is 100 bytes long, nIndex is 50 and nBytes is 75, only the bytes between 51 and 100 (50 bytes instead of 75 bytes) are written to the file.

Syntax

WriteBytes (nFile, svString, nIndex, nBytes);

Parameters

WriteBytes Parameters

Parameter

Description

nFile

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

svString

Specifies the string variable that contains the bytes to write to the output file.

nIndex

Specifies an index into svString. The bytes starting at this location are written to the output file. Note that the first byte is at index location 0.

nBytes

Specifies the number of bytes you want to write to the output file.

Return Values

WriteBytes Return Values

Return Value

Description

X

Where X is the number of bytes actually written.

< 0

Indicates that the function was unable to write the bytes.

See Also