开发者

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

开发者 https://www.devze.com 2023-03-16 07:36 出处:网络
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 toget dat from binary file and perform read and write oper

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

精彩评论

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