#include <string.h>
void *memccpy (
void *dest, /* destination buffer */
void *src, /* source buffer */
char c, /* character which ends copy */
int len); /* maximum bytes to copy */
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.
#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");
}
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.