_memccpy (Windows CE 5.0)

Send Feedback

Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference

Copies characters from a buffer.

void *_memccpy(    void*dest,    const void*src,    intc,    unsigned intcount);

Parameters

  • dest
    Pointer to destination.
  • src
    Pointer to source.
  • c
    Last character to copy.
  • count
    Number of characters.

Return Values

If the character c is copied, _memccpy returns a pointer to the byte in dest that immediately follows the character.

If c is not copied, it returns NULL.

Remarks

The _memccpy function copies 0 or more bytes of src to dest, halting when the character c has been copied or when count bytes have been copied, whichever comes first.

Example

/* MEMCCPY.C */

#include <memory.h>
#include <stdio.h>
#include <string.h>

char string1[60] = "The quick brown dog jumps over the lazy fox";

void main( void )
{
   char buffer[61];
   char *pdest;

   printf( "Function:\t_memccpy 60 characters or to character 's'\n" );
   printf( "Source:\t\t%s\n", string1 );
   pdest = _memccpy( buffer, string1, 's', 60 );
   *pdest = '\0';
   printf( "Result:\t\t%s\n", buffer );
   printf( "Length:\t\t%d characters\n\n", strlen( buffer ) );
}

Output

Function:   _memccpy 60 characters or to character 's'
Source:      The quick brown dog jumps over the lazy fox
Result:      The quick brown dog jumps
Length:      25 characters

Requirements

OS Versions: Windows CE 2.0 and later.
Header: stdlib.h.
Link Library: coredll.dll.

See Also

memchr | memcmp | memcpy | memset

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.