/
writeInt

writeInt

Description

Use to write one or more integer values to a file. This command will accept any number of integer arguments, including arrays.

The following list shows the different cast types. Note that data can be lost when casting. 'Signed' means the value can be negative. 'Unsigned' means value will always be positive.

Cast Description
"c" Writes integer as a signed character, or a signed 8 bit (1 byte) value
"uc" Writes integer as an unsigned character, or an unsigned 8 bit (1 byte) value
"s" Writes integer as a signed short integer, or a signed 16 bit (2 bytes) value
"us" Writes integer as an unsigned short integer, or an unsigned 16 bit (2 bytes) value
"i" Writes integer as a signed integer, or a signed 32 bit (4 bytes) value
"ui" Writes integer as an unsigned integer, or an unsigned 32 bit (4 bytes) value
"f" Writes integer as a floating point value, a 32 bit (4 byte) value

Functional area

Disk I/O

Command syntax

Syntax

writeInt fileID intVal1 [intVal2...] [-cast string]

Arguments

Name Type Required Comments
int2 optional int or int array
Command can accept any number of ints/arrays to write to the file
int1 int or int array
One or more values to be written to the file
fileID int
ID of file previously opened with fileOpen

Flags

Name Flag arguments Argument type Exclusive to Comments
cast 1 string Data type to cast to. Allowed types are listed above. Note: Data can be lost when casting.

Return value

void

Examples

//Write example
int $val = 50;
int $fileID;
int $fileID = `fileOpen "C:/FileTesting.txt" "w"`;
// Write the int value
writeInt $fileID $val;
fileClose $fileID;

Additional information

Related commands