| |||
| Home > RealView Debugger Predefined Macros > Alphabetical predefined macro reference > memcpy | |||
Copies a specified number of characters from a source memory area to a destination memory area.
char *memcpy (dest, src, count) char *dest; char *src; int count;
where:
destA character pointer that specifies the starting address for the destination memory area, to begin writing characters to.
srcA character pointer that specifies the starting address for the source memory area, to begin copying characters from.
countAn integer variable specifying the number of characters (bytes) to be copied, from the source location, to the destination location of memory.
Copies count characters from the source
memory area, pointed to by src, and writes this character
string to a destination memory area, pointed to by dest.
char *A pointer to the destination location that is one byte beyond the last byte written to. This enables continuation of the writing process with perfect alignment of bytes for string concatenation of memory blocks.
This example shows how to use memcpy:
define /R void memoryCpy()
{
char buff1[37];
char buff2[37];
char *posn;
strcpy(buff1,"1234567890abcdefghijklmnopqrstuvwxyz");
posn = memcpy(buff2,buff1,20);
$printf "%s\n",buff2$;
}
.