"Sputnik" help  
Sputnik Help
BinaryReadFloat(<binary>, <position>, <endian>)

Description

Reads a float from a binary array at the specified position.

Parameters

<binary> The binary array from which will be read.
<position> The position in the binary array to read from.
<endian> Optional endianness of the read. (Default: @EndianNative)

Return Value

Success: Returns the value read from the binary array.
Failure: Returns null if the position is out of bounds or an error occurs during reading.

Remarks

The BinaryReadFloat function reads a single float from the binary array at the specified position. The optional <endian> parameter allows you to specify the endianness of the value read. By default, it uses the machine-specific endianness, which can be accessed using the @EndianNative constant.

Related

BinaryWriteFloat

Example

Example of usage:

my $a = BinNew(16);

BinaryWriteFloat($a, 0, 13.7);
BinaryWriteFloat($a, 4, 31.337);
BinaryWriteFloat($a, 8, 1337.42);

say BinaryExpand($a, false);

say BinaryReadFloat($a, 0);
say BinaryReadFloat($a, 4);
say BinaryReadFloat($a, 8);

// PRINTS
// 33 33 5B 41 2D B2 FA 41 71 2D A7 44 00 00 00 00 33[A-.úAq-§D....
// 13.7
// 31.337
// 1337.42

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org