
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>memccpy() copy characters from buffer</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
memccpy() Copy Characters from Buffer
#include <mem.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
const void *source; Pointer to source
int ch; Last character to copy
size_t cnt; Maximum number of characters to copy
memccpy() copies characters from 'source' to 'dest', up to and
including the first occurrence of 'ch', or until a maximum of 'cnt'
bytes have been copied, whichever occurs first.
Returns: If 'ch' has been found and copied, a pointer to the
byte after 'ch' in 'dest' is returned. 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 usually are not
terminated with a null character ('\0'). The
buffer-manipulation routines always have a length or
count argument.
-------------------------------- Example ---------------------------------
The following statements copy characters from 'from_buffer' into
'to_buffer' until the "@" character is copied or 128 bytes are
copied, whichever happens first.
#include <mem.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