我正在尝试从服务器解密字符串。
我希望以下部分中的字符串 -
unsigned char Cipher1[] = {My String};
我的字符串是
“194,75,26,184,223,124,164,170,161,213,135,46,160,5,82,46,56,44,244,116,37,20,181,65,49,243,172,203,32,188,168,54,46,207,126,14,111,24,39,131,185,13,58,105,32,168,77, 83,202,165,242,198,34,192,161,39,202,58,230,72,234,218,171,50,187,235,124,24,16,2,117,188,221,73,136,37,81,217,30,17,57,136,91,224,178,12,37,255"
如何解决这个问题。
提前感谢。
答案 0 :(得分:4)
试试这个:
const unsigned char *string = (const unsigned char *) [MyString UTF8String];
答案 1 :(得分:1)
如果您只是想将NSString转换为char *,请使用- (const char *)cStringUsingEncoding:(NSStringEncoding)encoding
const char *cipher1 = [myString cStringWithEncoding: NSUTF8StringEncoding];