NSData hexadecimal to 16 bit integer?
NSData hexadecimal to 16 bit integer?
- Subject: NSData hexadecimal to 16 bit integer?
- From: Nick Morris <email@hidden>
- Date: Sat, 28 May 2005 10:55:42 +0100
Hi,
This is potentially a very stupid question.... However, I am stuck
and it is driving me nuts! There must be a really simple solution
that I am missing.
What I am trying to do is read in a file as NSData and extract
integer values (sounds simple!).
-------- Code --------
NSData *theFileData = [NSData dataWithContentsOfFile:aValidFlePath];
NSData *theData = [NSData dataWithData:[theFileData
subdataWithRange:NSMakeRange(0,2)]];
NSLog(@"%@", theData);
-------- End Code --------
The above gives '<docf>', which matches the start of a hex dump of
the file using BBEdit.
D0 CF 11 E0 A1 B1 1A E1 00 00 00 00 00 00 00 00
The dumb question is.....
How do I convert 'theData', i.e. docf, to an integer (53455).
Thanks in advance
Nick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden