Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>memccpy() copy characters from buffer</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 memccpy()               Copy Characters from Buffer

 #include   <memory.h>                   Required for declarations only
 #include   <string.h>                   Use either string.h or memory.h

 void       *memccpy(dest,source,ch,cnt);
 void *dest;                             Pointer to destination
 void *source;                           Pointer to source
 int        ch;                          Last character to copy
 unsigned   cnt;                         Maximum number of characters to copy

    memccpy() copies characters from 'source' to 'dest'.  The copy
    proceeds up to (and including) the first occurrence of 'ch', or it
    continues until a maximum of 'cnt' bytes have been copied.

    Returns:    A pointer to the byte after 'ch' in 'dest', if 'ch' has
                been found and copied.  NULL is returned if 'ch' was not
                copied.

      Notes:    Use memcpy() to copy 'cnt' bytes from one buffer to
                another without checking for a character.

                Buffers are arrays of characters and are usually not
                terminated with a null character ('\0').  The
                buffer-manipulation routines always have a length or
                count argument.

 Portability:   Not supported by ANSI standard.

   -------------------------------- Example ---------------------------------

    The following statement copies characters from 'from_buffer' into
    'to_buffer' until the "@" character or 128 bytes are copied,
    whichever happens first.

           #include <memory.h.

           char to_buffer[128];
           char from_buffer[128];
           char *bufptr;

           main()
           {
               bufptr = memccpy(to_buffer, from_buffer, '@', 128);
           }


See Also: memchr() memcmp() memcpy() memset()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson