"Sputnik" help  
Sputnik Help
BinaryWrite16BitCString(<binary>, <position>, <value>)

Description

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

Parameters

<binary> The binary array from which to write the string.
<position> The position in the binary array to start writing from.
<value> The string to write.

Return Value

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

Remarks

The BinaryWrite16BitCString function writes the 16-bit encoded characters of the string value to the binary array starting from the specified position. It appends a null terminator (two zero bytes) at the end of the string in the binary array.

Related

BinaryRead16BitCString

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