iOS NSData与Char Byte数组转化
作者:
c608 | 来源:发表于
2017-12-22 18:20 被阅读486次1. 字符串转Data
NSString * str =@"str";
NSData *data =[str dataUsingEncoding:NSUTF8StringEncoding];
2.NSData 转NSString
NSString * str =[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
3.data 转char
NSData *data;
char * haha=[data bytes];
4. char 转data
byte * byteData = malloc(sizeof(byte)*16);
NSData *content=[NSData dataWithBytes:byteData length:16];
本文标题:iOS NSData与Char Byte数组转化
本文链接:https://www.haomeiwen.com/subject/cuyxgxtx.html
网友评论