From WikiChip
Difference between revisions of "mirc/commands/bcopy"
< mirc‎ | commands

m (Bot: Adding a template)
m (bot: sort-key added to category)
Line 58: Line 58:
 
{{mIRC command list}}
 
{{mIRC command list}}
  
[[Category:MIRC commands]]
+
[[Category:mIRC commands|bcopy command - mIRC]]

Revision as of 19:53, 29 July 2014

Template:mIRC menu The /bcopy command can be used to copy any amount of bytes from one variable starting at a specific position into a second variable at a specific position. This command supports copying of overlapping buffers.

If the number of bytes to copy is -1, all bytes available will be copied over to the destination variable.

Note: The first byte starts at the position/index 1, 0 is invalid and will procudes an error.

Synopsis

/bcopy [-zc] <&dest_binvar> <des_pos> <&src_binvar> <src_pos> <numBytes>

Switches

  • -z - Bytes copied from the source binary variable gets zero-filled after the copy
  • -c - Truncates the destination variable to a length of <des_pos> + <numBytes>

Parameters

  • <&dest_binvar> - The destination binary variable.
  • <des_pos> - The position to which to copy the byte to.
  • <&src_binvar> - The source binary variable.
  • <src_pos> - The position from which to start copying bytes.
  • <numBytes> - Number of bytes to copy (or -1 for everything).

Example

Alias Example {
  ; Create a binary variable 'example' and assign it some text
  bset -t &example 1 This is a cool 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 
}

The above example will output:

This is a
cool test!

Compatibility

Added: mIRC v5.7
Added on: 02 Feb 2000
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also


[Expand]
v · d · e mIRC commands list