 | Cx51 User's Guide |  |
|
|
| memccpy| Summary | | | Description | The memccpy function copies 0 or more characters from src to dest. Characters are copied until the character c is copied or until len bytes have been copied, whichever comes first. | | Return Value | The memccpy function returns a pointer to the byte in dest that follows the last character copied or a null pointer if the last character copied was c. | | See Also | memchr, memcmp, memcpy, memmove, memset | | Example |
#include <string.h>
#include <stdio.h> /* for printf */
void tst_memccpy (void) {
char src1 [100] = "Copy this string to dst1";
char dst1 [100];
void *c;
c = memccpy (dst1, src1, 'g', sizeof (dst1));
if (c == NULL)
printf ("'g' was not found in the src buffer\n");
else
printf ("characters copied up to 'g'\n");
}
|
|
|