开发者

i want to read .bin file in my objective -c project and want to parse data accordingly

i want read data from the binary f开发者_运维百科ile named "xyz.bin" and want to parse data according to algorithm can any buddy suggest how to get dat from binary file and perform read and write operation on that binary file


if you're trying to access a file within your application bundle, you need to get the full path to it: [[NSBundle mainBundle] pathForResource: FILENAME ofType: FILEEXTENSION]

This returns an NSString, which you can pull a UTF8String out of and pass to fopen.


You want

NSData's

+ dataWithContentsOfURL: or + dataWithContentsOfFile: for input

and

– writeToFile:options:error: or – writeToURL:atomically: for output

What you do with the data in between is up to you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜