【发布时间】:2012-05-02 02:13:31
【问题描述】:
我正在通过以下方式接收 NSData
- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
{
char *ptr = (void *)[data bytes]; // set a pointer to the beginning of your data bytes
我正在接收数据,然后我需要将此数据与以下数组进行比较
char ch[3]={0x04,0x01,0X00};
因为数据来自服务器,但数据是动态的,我需要将许多这样的数组与我找到的以下方法的服务器数据进行比较,但它是静态方法,但无法按以下方式比较所有数组
if(*ptr == 0x04) {
}
ptr++;
if(*ptr == 0x01) {
}
ptr++;
if(*ptr==0X00){
}
but i can not compare all array so please help how
我可以比较
char *ptr = (void *)[data bytes];
与
char ch[3]={0x04,0x01,0X00};
请帮忙
【问题讨论】:
标签: iphone objective-c