Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/memccpy.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/memccpy.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/memccpy.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/memccpy.html on line 8
Copy bytes between buffers until a given byte is found
#include <string.h>
void* memccpy( void* dest,
const void* src,
int c,
size_t cnt );
- dest
- A pointer to where you want the function to copy the data.
- src
- A pointer to the buffer that you want to copy data from.
- c
- The value that you want to stop copying at.
- cnt
- The maximum number of bytes to copy.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The memccpy() function copies 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.
A pointer to the byte in dest following the character
c, if one is found and copied; otherwise, NULL.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char* msg = "This is the string: not copied";
int main( void )
{
char buffer[80];
memset( buffer, '\0', 80 );
memccpy( buffer, msg, ':', 80 );
printf( "%s\n", buffer );
return EXIT_SUCCESS;
}
produces the output:
This is the string:
POSIX 1003.1 XSI
Safety: | |
Cancellation point |
No |
Interrupt handler |
Yes |
Signal handler |
Yes |
Thread |
Yes |
memchr(),
memcmp(),
memcpy(),
memicmp(),
memmove(),
memset()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/memccpy.html on line 158
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/memccpy.html on line 158