"Sputnik" help  
Sputnik Help
BinaryRead16BitCString(<binary>, <position>)

Description

Reads a 16-bit encoded C-style string from a binary array starting from the specified position.

Parameters

<binary> The binary array from which to read the string.
<position> The position in the binary array to start reading from.

Return Value

Success: Returns the 16-bit C-style string.
Failure: Returns null.

Remarks

The BinaryRead16BitCString function reads the 16-bit encoded characters from the binary array starting from the specified position until a null terminator (two zero bytes) is encountered. It returns the resulting string.

Related

BinaryWrite16BitCString

Example

Example of usage:

my $a = BinNew(64);

BinaryWrite16BitCString($a, 0, "Cat");
BinaryWrite16BitCString($a, 8, "Dog");
BinaryWrite16BitCString($a, 16, "Fox");

say BinaryExpand($a, false);

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

// PRINTS
// 43 00 61 00 74 00 00 00 44 00 6F 00 67 00 00 00 C.a.t...D.o.g...
// 46 00 6F 00 78 00 00 00 00 00 00 00 00 00 00 00 F.o.x...........
// Cat
// Dog
// Fox

 


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