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

Description

Reads a byte 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 BinaryReadByte function reads a single byte 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

BinaryWriteByte

Example

Example of usage:

my $a = BinNew(16);

BinaryWriteByte($a, 0, 'T');
BinaryWriteByte($a, 1, 10);
BinaryWriteByte($a, 2, 0x20);

say BinaryExpand($a, false);

say BinaryReadByte($a, 0);
say BinaryReadByte($a, 1);
say BinaryReadByte($a, 2);

// PRINTS
// 54 0A 20 00 00 00 00 00 00 00 00 00 00 00 00 00 T. .............
// 84
// 10
// 32

 


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