Use to write one or more floating point values to a file. This command will accept any number of floating point 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 float as a signed character, or a signed 8 bit (1 byte) value |
"uc" | Writes float as an unsigned character, or an unsigned 8 bit (1 byte) value |
"s" | Writes float as a signed short integer, or a signed 16 bit (2 bytes) value |
"us" | Writes float as an unsigned short integer, or an unsigned 16 bit (2 bytes) value |
"i" | Writes float as a signed integer, or a signed 32 bit (4 bytes) value |
"ui" | Writes float as an unsigned integer, or an unsigned 32 bit (4 bytes) value |
"f" | Writes float as a floating point value, a 32 bit (4 byte) value |
Disk I/O
writeFloat fileID floatVal1 [floatVal2...] [-cast string] |
Name | Type | Required | Comments |
---|---|---|---|
float2 | optional float or float array | Command can accept any number of floats/arrays to write to the file | |
float1 | float or float array | One or more values to be written to the file | |
fileID | int | ID of file previously opened with fileOpen |
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
cast | 1 | string | — | Data type to cast to. Possible types are listed above. Note that data can be lost when casting. |
void
//Write example float $val = 5.75; int $fileID; int $fileID = `fileOpen "C:/FileTesting.txt" "w"`; // Write the float value writeFloat $fileID $val; fileClose $fileID; |