• 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 to long
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData to long


  • Subject: Re: NSData to long
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Tue, 8 Apr 2003 08:09:45 -0400

On Monday, Apr 7, 2003, at 21:50 US/Eastern, David Blanton wrote:

NSAppleEventDescriptor * aDescriptor = [theDescriptor descriptorAtIndex:i];

theData = [aDescriptor data];

NSLog(@"theData %@",theData); yields : theData <00000024 >

I want to convert the NSData object <00000024> to an NSString that would be
"36"


NSString * str = [[NSNumber numberWithLong:foo] stringValue];

Would work if I could make <00000024> into a long. So how does one get a
long value from an NSData object?

As long as [theData length] >= sizeof(long):

long aLong = *(const long*)[theData bytes];



--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSData to long (From: David Blanton <email@hidden>)

  • Prev by Date: Re: How-To: private framework
  • Next by Date: Re: NSData to long
  • Previous by thread: NSData to long
  • Next by thread: Re: NSData to long
  • Index(es):
    • Date
    • Thread