简体   繁体   English

如何从目标c中的NSData变量读取24个字节后的其余字节

[英]How can I read rest of bytes after 24 bytes from a NSData variable in objective c

如何从目标c中的NSData变量读取24个字节后的其余字节?

You can use the subdataWithRange: method of NSData to get an NSData object with the data after the first 24 bytes. 您可以使用NSDatasubdataWithRange:方法来获取一个NSData对象,其中前24个字节之后的数据。

You would do something like: 您将执行以下操作:

NSData *newData = [data subdataWithRange:NSMakeRange(24, [data length] - 24)];

There is also the getBytes:range: method that returns the bytes in a buffer. 还有getBytes:range:方法,该方法返回缓冲区中的字节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM