Name

memccpy - copies memory area

Library

libc.lib

Synopsis

  #include <string.h>
  void * memccpy (void *dst, const void *src, int c, size_t len);

Return values

memccpy function returns a pointer to the next character in dst after c, or NULL if c was not found in the first n characters of src


Detailed description

The memccpy function copies bytes from string src to string dst. If the character c (as converted to an unsigned char) occurs in the string src, the copy stops and a pointer to the byte after the copy of c in the string dst is returned. Otherwise, len bytes are copied, and a NULL pointer is returned.

Examples

#include <string.h>
#include <stdio.h>
int main()
{
    char one[50] = {"\0"};
    (void) memccpy(one, "abcdefgh",8,3);
    printf("String after memcpy %s\n",one);
    (void) memccpy(one, "Hello",5,1);
    printf("String after memcpy %s\n",one);
    return 0;
}

         

Output

String after memcpy abc
String after memcpy Hbc

         

See also

bcopy, memcpy, memmove, strcpy

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top