Core Function BinaryAppend
From Sputnik Wiki
				
				
				(Difference between revisions)
				
																
				
				
								
				 (Created page with "<pre> BinaryAppend( <binary-array>, <binary-array2>, <flag> ) </pre>  === Description ===  Append a binary variables data onto the end or beginning of another binary variables da...")  | 
		 (→Example)  | 
		||
| Line 40: | Line 40: | ||
<syntaxhighlight lang="sputnik">  | <syntaxhighlight lang="sputnik">  | ||
| − | $binary = Pack("z0", "The quick brown FoX")  | + | $binary = Pack("z0", "The quick brown FoX");  | 
| − | $binary2 = Pack("z0", " jumps over the lazy dog")  | + | $binary2 = Pack("z0", " jumps over the lazy dog");  | 
| − | BinaryAppend($binary, $binary2)  | + | BinaryAppend($binary, $binary2);  | 
| − | println( Unpack("z0", $binary) ) ; Prints: The quick brown FoX jumps over the lazy dog  | + | println( Unpack("z0", $binary) ); // Prints: The quick brown FoX jumps over the lazy dog  | 
</syntaxhighlight>  | </syntaxhighlight>  | ||
| Line 49: | Line 49: | ||
<syntaxhighlight lang="sputnik">  | <syntaxhighlight lang="sputnik">  | ||
| − | $binary = Pack("z0", "The quick brown FoX")  | + | $binary = Pack("z0", "The quick brown FoX");  | 
| − | $binary2 = Pack("z0", " jumps over the lazy dog")  | + | $binary2 = Pack("z0", " jumps over the lazy dog");  | 
| − | BinaryAppend($binary, $binary2, 1)  | + | BinaryAppend($binary, $binary2, 1);  | 
| − | println( Unpack("z0", $binary) ) ; Prints: jumps over the lazy dogThe quick brown FoX  | + | println( Unpack("z0", $binary) ); // Prints: jumps over the lazy dogThe quick brown FoX  | 
</syntaxhighlight>  | </syntaxhighlight>  | ||
[[Category:Core Function]]  | [[Category:Core Function]]  | ||
Revision as of 17:43, 19 November 2011
BinaryAppend( <binary-array>, <binary-array2>, <flag> )
Contents | 
Description
Append a binary variables data onto the end or beginning of another binary variables data.
Parameters
binary-array
The binary variable to append to.
binary-array2
The binary variable to be appended.
flag
Optional; Flag to choose where to append to:
0 = Append to end
1 = Apend to beginning
Return Value
Success: Returns 1.
Failure: Returns 0.
Remarks
This modifies the original variable and does not return a copy of it.
Example
Append data to end:
$binary = Pack("z0", "The quick brown FoX"); $binary2 = Pack("z0", " jumps over the lazy dog"); BinaryAppend($binary, $binary2); println( Unpack("z0", $binary) ); // Prints: The quick brown FoX jumps over the lazy dog
Append data to beginning:
$binary = Pack("z0", "The quick brown FoX"); $binary2 = Pack("z0", " jumps over the lazy dog"); BinaryAppend($binary, $binary2, 1); println( Unpack("z0", $binary) ); // Prints: jumps over the lazy dogThe quick brown FoX