if(lastByte==0x0){
//string is null-terminated
str=[NSStringstringWithUTF8String:[self bytes]];
}
else{
//string is not null-terminated
str=[[NSStringalloc]initWithData:self encoding:NSUTF8StringEncoding];
}
if(lastByte==0x0){
//string is null-terminated
str=[NSStringstringWithUTF8String:[self bytes]];
}
else{
//string is not null-terminated
str=[[NSStringalloc]initWithData:self encoding:NSUTF8StringEncoding];
}
本文标题:关于NSData末尾为Null-terminated的处理
本文链接:https://www.haomeiwen.com/subject/ayapqttx.html
网友评论