首页 > 代码库 > strcpy unsigned char

strcpy unsigned char

http://bbs.csdn.net/topics/250068243

 

char *strcpy(char* dest, const char *src);

用unsigned char编译会出错

U8 dest[5];

U8 src[5] = {0x01,0x02,0x03,0x04,0x05};

//加上强制转换

strcpy((char*)dest, (char*)src);

 

或者使用 void *memcpy(void *dest, const void *src, size_t n);

memcpy(dest, src, 5);