memccpy, fmemccpy
raw OCR
Copies a block of n bytes.
Defined in header <mem.h>
Syntax
#include <mem.h>
Near version: void *memccpy(void *dest, const void *src, int c,size_t n);
Far version: void far * far _f memccpy (void far *dest, const void far *src,
int c, size_t n)
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| Near version | ■ | ■ | ■ | ||
| Far version | ■ | ■ |
Remarks
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:
D The character c is first copied into dest. a n bytes have been copied into dest.
Retum Value
memccpy returns a pointer to the byte in dest immediately following c, if c was copied; otherwise, memccpy returns null.
See also
Example
#include <string.h>
#include <stdio.h>
int main(void)
{
char *src = "This is the source string", dest[50], *ptr;
ptr = (char *) memccpy (dest, src, 'c', strlen(src));
if (ptr) {
*ptr = '\0';
printf("The character was found: %s\n", dest);
else
printfC'The character wasn't found\n");
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `memccpy, Jmemccpy` read as `memccpy, fmemccpy`
Stable link: /3.1/mem.h/memccpy/
· short form /3.1/memccpy/