Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 11-09-2011, 09:17 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 2
rzumbado is on a distinguished road
Default Little Endian From Binary File?

Hi there all!

I'm looking for a way to get an int value from a binary file. So lets say i have this file "myfile.dat" where from my PC i stored a lot of stuff...
Now i need to read that file from my IPhone and show the data...

on the "myfile.dat" i have this (binary and all ints are little endian):
0-12: A signature string
13-16: An int number (note that length = 4)

So using NSData i know i can read from pos 13 to pos 16 and get those bytes... i can get the first 0-12 string correctly, but i cannot read pos 13-16 and convert it to an int value in Obj-C.... ;(

I have something like:

Code:
unsigned char bytes[length];
[_data getBytes:bytes range:NSMakeRange(offset, length)];
int32_t elem = OSReadLittleInt32(bytes, 0);
Now, im a newbie when it comes to Obj-C and C/C++... all my life i have been working with C# (sad)...

Can anyone help? THANKS IN ADVANCE!
rzumbado is offline   Reply With Quote
Old 11-09-2011, 07:55 PM   #2 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 2
rzumbado is on a distinguished road
Smile

if you want to know the answer is here: iphone - Obj-C Read Little Endian From Binary File? (xcode) - Stack Overflow
rzumbado is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 395
10 members and 385 guests
bignoggins, djqbert, epaga, flamingliquid, jcdevelopments, LunarMoon, markolo, omagod, pinacate, taylor202
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,644
Threads: 94,111
Posts: 402,861
Top Poster: BrianSlick (7,990)
Welcome to our newest member, djqbert
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:59 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0