一个问题,当memccpy
找不到字符时,目标缓冲区会如何处理?
该手册未对失败后dest
的状态进行任何说明。它会覆盖还是保持不变?以下是从手册页复制的内容。
void *memccpy(void *dest,const void *src,int c,size_t n);
DESCRIPTION
The memccpy() function copies no more than n bytes from memory area src to memory area dest,stopping when the character c is found.
If the memory areas overlap,the results are undefined.
RETURN VALUE
The memccpy() function returns a pointer to the next character in dest after c,or NULL
if c was not found in the first n characters of src.