Copies data from the specified source address to the specified destination address.
[ lBytesCopied = ] MemoryCopy ( dwDstAddr, dwSrcAddr, lSize, [lCount] )
The MemoryCopy procedure syntax has the following parts:
Name |
Type |
Description |
lBytesCopied |
Long |
Return number of bytes actually copied. Negative number indicate an error. |
dwDstAddr |
Val DWord |
Address of buffer to which data bytes will be copied. |
dwSrcAddr |
Val DWord |
Address of buffer from which data bytes will be copied.. |
lSize |
Val Long |
Number of bytes to copy from dwSrcAddr. |
lCount |
[Val] Long |
Optional. Indicate the number of times to copy lSize from dwSrcAddr. The default value is 1. |
The function is used to copy data from one variable to another. No conversion is performed if the data types are different.
This function does not check whether the addresses or number of bytes are correct. Incorrect values may damage any ATEasy variable or programs, etc. or generate access violation.
The following example copies the content of double word (4 bytes) to an array of 4 bytes:
aucBytes : Byte[4]
dw: DWord
MemoryCopy(&aucBytes, &dw, 4)
The following example copies the hi word of a double word variable to the first and the second bytes of the array and the third and fourth bytes of the array:
MemoryCopy(&aucBytes, &dw, 2, 2)
The following example fills the char array starting at the second char with 3 copies of the first two chars of the string:
acChars : Char[7]
s: String = "ABC"
dwAddr: DWord
dwAddr=&acChars
MemoryCopy(dwAddr+1, &s, 2, 3) ! "ABABAB" will be filled into the last 6 bytes of 'acChars'