Header File
mem.h, string.h
Category
Memory and String Manipulation Routines
Prototype
void *memccpy(void *dest, const void *src, int c, size_t n);
Description
Copies a block of n bytes.
memccpy is available on UNIX System V systems.
memccpy copies a block of n bytes from src to dest. The copying stops as soon as either of the following occurs:
memccpy returns a pointer to the byte in dest immediately following c, if c was copied; otherwise, memccpy returns NULL.
Example
#include <string.h> #include <stdio.h> int main(void) { char *src = "This is the source string"; char dest[50]; char *ptr; ptr = (char *) memccpy(dest, src, 'c', strlen(src)); if (ptr) { *ptr = '\0'; printf("The character was found: %s\n", dest); } else printf("The character wasn't found\n"); return 0; }
Portability
POSIX |
Win32 |
ANSI C |
ANSI C++ |
|
+ |
|
|
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|