• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSData hexadecimal to 16 bit integer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSData hexadecimal to 16 bit integer?
      • From: Nick Zitzmann <email@hidden>
    • Re: NSData hexadecimal to 16 bit integer?
      • From: Andreas Monitzer <email@hidden>
  • Prev by Date: Re: Document Types
  • Next by Date: Re: NSData hexadecimal to 16 bit integer?
  • Previous by thread: Re: CoreData apps & applicationShouldTerminate
  • Next by thread: Re: NSData hexadecimal to 16 bit integer?
  • Index(es):
    • Date
    • Thread