开发者

Copy unsigned char array

开发者 https://www.devze.com 2023-01-31 23:01 出处:网络
What would be the best way to copy unsigned char array to another? For example: unsigned char q[1000]; unsigned char p[1000];

What would be the best way to copy unsigned char array to another?

For example:

unsigned char q[1000];
unsigned char p[1000];
开发者_StackOverflow中文版
strcpy (q,&p);

The above code does not work, it gives me error saying "cannot convert parameter 1 from unsigned char [1000] to char *".


As indicated by its name, strcpy works on C string (which a unsigned char array is not).

You should consider memcpy.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号