Bcopy » History » Revision 6
« Previous |
Revision 6/7
(diff)
| Next »
Per Amundsen, 11/18/2018 07:24 AM
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. (If N = -1, bytes are appended to the destination &binvar)
<&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 6 years ago · 6 revisions