Core Function BinaryInsert
From Sputnik Wiki
BinaryInsert( <binary-array>, <binary-array2>, <index> )
Contents |
Description
Insert a binary variables data into another binary variable at a specific location.
Parameters
binary-array
The binary variable to insert data to.
binary-array2
The binary variable to copy data from.
index
The index position to insert at.
Return Value
Success: Returns 1.
Failure: Returns 0.
Remarks
This modifies the original binary variable and does not return a copy.
Example
$binary1 = Pack("z0", "111 333"); $binary2 = Pack("z0", " 222"); BinaryInsert($binary1, $binary2, 3); $k = 0; For ($binary1 as $i) { println( DecPad($k, 3) . " Byte: " . $i . " | Hex: " . Hex($i) . " | Char: " . Chr($i) ); $k++; } println( Unpack("z0", $binary1) ); // Prints: 111 222 333