Re: [問題] char to NSString
※ 引述《heyshi (baw)》之銘言:
: NSData *buf;
: NSString *str;
: 想請問有沒有更短的寫法??
: 我改寫成以下寫法就爆了 Q_Q
: str = [NSString stringWithFormat:@"%d",
: [[buf subdataWithRange:NSMakeRange(127, 1)] bytes]];
試試看這樣
str = [NSString stringWithFormat:@"%d",
*(char *)[[buf subdataWithRange:NSMakeRange(127, 1)] bytes]];
--
zonble.net
cocoa.zonble.net
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.69.67.252
推
03/26 18:58, , 1F
03/26 18:58, 1F
討論串 (同標題文章)