Bcopy » History » Revision 5
« Previous |
Revision 5/7
(diff)
| Next »
Per Amundsen, 02/08/2014 11:34 PM
Added in 1.9.0
/bcopy [-zc] <&binvar> <N> <&binvar> <S> <M>
Copies <M> bytes from position <S> in the second &binvar to the first &binvar at position <N>.
This can also be used to copy overlapping parts of a &binvar to itself.
Switches
-z - The bytes in the second &binvar that is copied are zero-filled after the copy.
-c - The first &binvar is chopped to <N> + <M>.
Parameters
<&binvar> - Target &binvar to copy to.
<N> - Target position in the first &binvar to copy to.
<&binvar> - Source &binvar to copy from.
<S> - Source position to copy from.
<M> - Number of bytes to copy.
Example
alias /example { ;Create a binary variable and assign it some text bset -t &example 1 This is a test! ;Copy from 'example' from the 11th byte 10 bytes onward ;Zero-fill the part that was copied bcopy -z &example2 1 &example 11 10 ;Print out &example's content (up to the first null) echo -a $bvar(&example, 1-).text ;Print out &example2's content echo -a $bvar(&example2, 1-).text }
Updated by Per Amundsen almost 11 years ago · 5 revisions