Difference between revisions of "Bcopy"
m (corrected binary files-link) |
m |
||
Line 8: | Line 8: | ||
The -z switch will zero fill all bytes in &source that were copied. | The -z switch will zero fill all bytes in &source that were copied. | ||
The -c switch will chop © to N + M bytes. | The -c switch will chop © to N + M bytes. | ||
+ | |||
+ | == Examples == | ||
+ | [[bset]] &data 65 66 67 68 69 | ||
+ | bcopy &test 1 &data 3 2 | ||
+ | [[echo]] -a $bvar(&test,1,$bvar(&test,0)) | ||
+ | This will copy the values 67 68 from &data to &test. |
Revision as of 17:04, 13 October 2006
The bcopy command is used to copy a (part of a) binary file.
bcopy [-zc] <©> <N> <&source> <S> <M>
This copies M bytes from &source starting at position S to © starting at position N. If © doesn't exist yet, the binary file will be created and zero filled to the Nth byte. If © already exists but smaller then N bytes, it will be extended with zeros to the Nth byte. If © already exists and is N bytes or larger, the copied bytes will overwrite the old bytes in ©. If &source is smaller then S + M - 1 bytes and &source is equal or larger then S bytes, then all bytes starting from S to the last byte will be copied. If &source is smaller then S bytes, you will get an error. You can use M = -1 to copy all bytes starting from byte S to the last byte.
The -z switch will zero fill all bytes in &source that were copied. The -c switch will chop © to N + M bytes.
Examples
bset &data 65 66 67 68 69 bcopy &test 1 &data 3 2 echo -a $bvar(&test,1,$bvar(&test,0))
This will copy the values 67 68 from &data to &test.