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

Description

Writes a null-terminated UTF-32 encoded string to a binary string at the specified position. This function allows you to insert a string into a binary string, ensuring it is null-terminated.

Parameters

<binary> The binary string to write the UTF-32 encoded string into.
<position> The position at which to write the UTF-32 encoded string.
<value> The UTF-32 encoded string to be written.

Return Value

Success: Returns true if the write operation is successful.
Failure: Returns null if the position is invalid or out of bounds.

Remarks

The BinaryWriteUtf32CString function allows you to insert a null-terminated UTF-32 encoded string into a binary string. It ensures that the written string is properly terminated with a null character (0x00). If the position is invalid or out of bounds, the function will return null, indicating a failure.

Related

BinaryReadUtf32CString

Example

Example of usage:

my $a = BinNew(128);

BinaryWriteUtf32CString($a, 0, "Quick");
BinaryWriteUtf32CString($a, 32, "Brown");
BinaryWriteUtf32CString($a, 64, "Fox");

say BinaryExpand($a, false);

say BinaryReadUtf32CString($a, 0);
say BinaryReadUtf32CString($a, 32);
say BinaryReadUtf32CString($a, 64);

// PRINTS
// 51 00 00 00 75 00 00 00 69 00 00 00 63 00 00 00 Q...u...i...c...
// 6B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 k...............
// 42 00 00 00 72 00 00 00 6F 00 00 00 77 00 00 00 B...r...o...w...
// 6E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 n...............
// 46 00 00 00 6F 00 00 00 78 00 00 00 00 00 00 00 F...o...x.......
// Quick
// Brown
// Fox

 


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