User manual

MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 346 2012 Microchip Technology Inc.
See Also
strncpy(), strncmp(), strchr(), memset(), memchr()
Return Value
Returns negative one, zero or one, depending on whether s1 points to string which is
less than, equal to or greater than the string pointed to by
s2 in the collating sequence.
MEMCPY
Synopsis
#include <string.h>
void * memcpy (void * d, const void * s, size_t n)
Description
The memcpy() function copies n bytes of memory starting from the location pointed to
by
s to the block of memory pointed to by d. The result of copying overlapping blocks
is undefined. The
memcpy() function differs from strcpy() in that it copies a specified
number of bytes, rather than all bytes up to a null terminator.
Example
#include <string.h>
#include <stdio.h>
void
main (void)
{
char buf[80];
memset(buf, 0, sizeof buf);
memcpy(buf, "A partial string", 10);
printf("buf = ’%s’\n", buf);
}
See Also
strncpy(), strncmp(), strchr(), memset()
Return Value
The memcpy() routine returns its first argument.
MEMMOVE
Synopsis
#include <string.h>
void * memmove (void * s1, const void * s2, size_t n)
Description
The memmove() function is similar to the function memcpy() except copying of
overlapping blocks is handled correctly. That is, it will copy forwards or backwards as
appropriate to correctly copy one block to another that overlaps it.
See Also
strncpy(), strncmp(), strchr(), memcpy()