Vicon Shogun banner

Description

Use to read a Boolean value from a file. Command will fail if at the end of the file. The following is a listing of the different cast types.

Note that data can be lost when casting. 'Signed' means the value can be negative. 'Unsigned' means the value will always be positive.

CastDescription
cReads a signed character, or signed 8-bit (1 byte) value, and converts it to a Boolean
ucReads an unsigned character, or unsigned 8-bit (1 byte) value, and converts it to a Boolean
sReads a signed short integer, or signed 16-bit (2 bytes) value, and converts it to a Boolean
usReads an unsigned short integer, or unsigned 16-bit (2 bytes) value, and converts it to a Boolean
iReads a signed integer, or signed 32-bit (4 bytes) value, and converts it to a Boolean
uiReads an unsigned integer, or unsigned 32-bit (4 bytes) value, and converts it to a Boolean
fReads a floating point value, a 32-bit (4 byte) value, and converts it to a Boolean

Functional area

Disk I/O

Command syntax

Syntax

readBool fileID [-cast string]

Arguments

NameTypeRequiredComments
fileIDint
ID of file previously opened with fileOpen

Flags

NameFlag argumentsArgument typeExclusive toComments
cast1stringData type to cast from. Possible types are listed above. Note that data can be lost when casting.

Return value

boolean

Examples

//Read example
boolean $val;
int $fileID;
int $fileID = `fileOpen "C:/FileTesting.txt" "r"`;
// Read the boolean value
$val = `readBool $fileID`;
 
fileClose $fileID; //make sure to close the file

// Display the value
print $val;

Additional information

Related commands