原型:extern void *memccpy(void *dest, void *src, unsigned char
c, unsigned int count);
参数:
dest Pointer to the destination.
src Pointer to the source.
c Last character to copy.
count Number of characters.
用法:#include <string.h>
功能:由src所指内存区域复制不多于count个字节到dest所指内存区域,如果遇到字符c则停止复制。
返回值:如果c没有被复制,则返回NULL,否则,返回一个指向紧接着dest区域后的字符的指针。
举例:
// memccpy.c
#include <syslib.h>
#include <string.h>
main()
{
char *s="Golden Global View";
char d[20],*p;
clrscr();
p=memccpy(d,s,'x',strlen(s));
if(p)
{
*p='\0'; // MUST Do This
printf("Char found: %s.\n",d);
}
else
printf("Char not found.\n");
getchar();
return 0;
}