以下是相关的C++源代码:
typedef unsigned char BTUINT8;
//... 省略无关代码 ...
BTUINT8 szDevName[BTSDK_DEVNAME_LEN] = { 0 };
BTUINT8 szTmp[32] = { 0 };
//... 省略无关代码 ...
strcpy(szTmp, szDevName);
error C2664: 'strcpy' : cannot convert parameter 1 from 'unsigned char [32]' to 'char *'
以上代码编译不通过,如果把unsigned char改成char那么这一行可以通过编译,但其他部分代码就要进行很大的修改了!
有没有办法让strcpy接收unsigned char []参数?
或者干脆换其他函数来完成字符串拷贝?
typedef unsigned char BTUINT8;
//... 省略无关代码 ...
BTUINT8 szDevName[BTSDK_DEVNAME_LEN] = { 0 };
BTUINT8 szTmp[32] = { 0 };
//... 省略无关代码 ...
strcpy(szTmp, szDevName);
error C2664: 'strcpy' : cannot convert parameter 1 from 'unsigned char [32]' to 'char *'
以上代码编译不通过,如果把unsigned char改成char那么这一行可以通过编译,但其他部分代码就要进行很大的修改了!
有没有办法让strcpy接收unsigned char []参数?
或者干脆换其他函数来完成字符串拷贝?