• 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
Re: NSData hexadecimal to 16 bit integer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData hexadecimal to 16 bit integer?


  • Subject: Re: NSData hexadecimal to 16 bit integer?
  • From: Nick Zitzmann <email@hidden>
  • Date: Sat, 28 May 2005 11:09:50 -0600


On May 28, 2005, at 3:55 AM, Nick Morris wrote:

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).

Just declare an integer as normal, and then use the -[NSData getBytes:length:] method to copy the first two bytes (D0 CF) into the integer:


int yourInt;
[theData getBytes:&yourInt length:2];

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________
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


References: 
 >NSData hexadecimal to 16 bit integer? (From: Nick Morris <email@hidden>)

  • Prev by Date: Re: NSTableView Context Menu - Select Row
  • Next by Date: CoreData: filtering controller content
  • Previous by thread: Re: NSData hexadecimal to 16 bit integer?
  • Next by thread: Using [NSWorkspace getFileSystemInfoForPath:...]
  • Index(es):
    • Date
    • Thread