简体   繁体   中英

Reading binary file into array in Objective-C [iPhone]

I want to read binary file on my iPhone. I have .txt file which stores information about an array: int[6000][9] How can I put this data into an array in my code?

I tried this:

int mapa1[6000][9];

NSFileHandle* file = [NSFileHandle fileHAndleForReadingAtPAth: @"level1.txt"];
[[file readDataOfLength:4] getBytes:mapa1];
mapa1 = NSSwapLittleIntToHost(mapa1);

But on the last line I receive error: "Incompatible types in assigment" So I don't know how to copy this binary file into the array...

Can someone help me?

mapa1不是无符号的int,这是NSSwapLittleIntHost的返回值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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