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

Description

Writes a C-style string from 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.
Failure: Returns null if the position is out of bounds or an error occurs during writing..

Remarks

The BinaryWriteCString function writes the characters of the string value to the binary array starting from the specified position. It appends a null terminator (byte value 0) at the end of the string in the binary array.

Related

BinaryReadCString

Example

Example of usage:

my $a = BinNew(64);

BinaryWriteCString($a, 0, "Cat");
BinaryWriteCString($a, 4, "Dog");
BinaryWriteCString($a, 8, "Fox");

say BinaryExpand($a, false);

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

// PRINTS
// 43 61 74 00 44 6F 67 00 46 6F 78 00 00 00 00 00 Cat.Dog.Fox.....
// Cat
// Dog
// Fox

 


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