"Sputnik" help  
Sputnik Help
BinaryWriteDouble(<binary>, <position>, <value>, [<endian>])

Description

Writes a double value to a binary array at the specified position.

Parameters

<binary> The binary array to write to.
<position> The position in the binary array to write to.
<value> The value to be written.
<endian> Optional endianness of the write. (Default: @EndianNative)

Return Value

Success: Returns true if the value was written successfully.
Failure: Returns null if the position is out of bounds or an error occurs during writing.

Remarks

The BinaryWriteDouble function writes a single double value to the binary array at the specified position. The optional <endian> parameter allows you to specify the endianness of the value when written. By default, it uses the machine-specific endianness, which can be accessed using the @EndianNative constant.

Related

BinaryReadDouble

Example

Example of usage:

my $a = BinNew(32);

BinaryWriteDouble($a, 0, 13.7);
BinaryWriteDouble($a, 8, 31.337);
BinaryWriteDouble($a, 16, 1337.42);

say BinaryExpand($a, false);

say BinaryReadDouble($a, 0);
say BinaryReadDouble($a, 8);
say BinaryReadDouble($a, 16);

// PRINTS
// 66 66 66 66 66 66 2B 40 83 C0 CA A1 45 56 3F 40 ffffff+@.ÀÊ¡EV?@
// 48 E1 7A 14 AE E5 94 40 00 00 00 00 00 00 00 00 Ház.®å.@........
// 13.7
// 31.337
// 1337.42

 


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