Ansistring转为unsigned char *
例子:
Ansistring aa = "0xA0";
unsigned char *bb;
需要把Ansistring转为unsigned char 存入bb中
不要告诉我bb = aa.c_str();
[解决办法]
用循环加移位
[解决办法]
AnsiString aa = "0xA0"; unsigned char *bb = new unsigned char[aa.Length()+1];for (int i = 0; i < aa.Length(); i++){ bb[i] = aa[i + 1];}//bb[aa.Length()]='\0';//ShowMessage(strlen(bb));//ShowMessage((char *)bb);delete []bb;
[解决办法]
你那个循环写了个a++