Core Function BinaryInsert

From Sputnik Wiki
Revision as of 17:44, 19 November 2011 by UberFoX (Talk | contribs)
Jump to: navigation, search
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;
Foreach ($binary1 as $i)
{
	println( DecPad($k, 3) . " Byte: " . $i . " | Hex: " . Hex($i) . " | Char: " . Chr($i) );
	$k++;
}
println( Unpack("z0", $binary1) ); // Prints: 111 222 333
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox