copy bytes until a given character is found
#include <string.h>
void *memccpy( void *dest,
const void *src,
int c,
size_t cnt );
void __far *_fmemccpy( void __far *dest,
const void __far *src,
int c,
size_t cnt );
The memccpy() and _fmemcpy() functions copy bytes from src to dest, up to and including the first occurrence of the character c, or until cnt bytes have been copied, whichever comes first.
The _fmemccpy() function is a data-model-independent form of the memcppy() function. It accepts far pointer arguments, and returns a far pointer. It is most useful in mixed memory model applications.
The memccpy() and _fmemcpy() functions return a pointer to the byte in dest following the character c, if one is found and copied, otherwise they return NULL.
#include <stdio.h>
#include <string.h>
char *msg = "This is the string: not copied";
void main()
{
char buffer[80];
memset( buffer, '\0', 80 );
memccpy( buffer, msg, ':', 80 );
printf( "%s\n", buffer );
}
produces the output:
This is the string:
WATCOM