void* memcpy(void* pvTo, const void* pvForm, size_t size)
{
assert((pvTo!= NULL) && (pvFrom!= NULL));//使用断言防止传递空地址
unsigned char* pbTo = (unsigned char*)pvTo;//防止改变pvTo的地址
unsigned char* pbFrom = (unsigned char*)pvFrom;//防止改变pvFrom的地址
while(size-- > 0)
{
*pbTo++ = *pbFrom++;
}
return pvTo;
}
char* strcpy(char* pDest, const char* pSrc)
{
assert((pDest != NULL) && (pSrc != NULL));
char *pTmp = pDest;
while ((*pDest++ = *pSrc++) != '/0')
;
return pTmp;
}
char * strcat(char * dest, const char * src)
{
char *tmp = dest;
while (*dest)
dest++;
while ((*dest++ = *src++) != '/0')
;
return tmp;
}