Actions
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
| Switch | Description |
| -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
| Parameter | Description |
| <&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 over 2 years ago · 7 revisions