词条 | memccpy |
释义 | 原型: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.\",d); } else printf("Char not found.\"); getchar(); return 0; } |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。