memccpy, _fmemccpy

copy bytes until a given character is found

Synopsis:

#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 );

Description:

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.

Returns:

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.

See also:

memcpy(), memmove(), memset()

Examples:

#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:

Classification:

WATCOM

Systems:

memccpy()
All (except DOS/PM)
_fmemccpy()
All (except Netware, DOS/PM)