How do you convert a byte array to a int or long, NSNumber has not byte init method.
How do you convert a byte array to a int or long, NSNumber has not byte init method.
- Subject: How do you convert a byte array to a int or long, NSNumber has not byte init method.
- From: Martin <email@hidden>
- Date: Mon, 7 May 2007 19:12:27 +0100
I want to create a int or long from a series of bytes that are in a
NSData object. It does not appear that a NSNumber object can be
created from a byte array, I normally use Java and could create a
BigDecimal using a byte array in the constructor.
What data type do I use to create a buffer for the call [dataObject
getBytes:buff range:aRange]
I know that the range I want is either 4 or 2 bytes, i.e.
NSRange fourBytes = {8,4}
NSRange twoBytes = {16, 2}
Thanks Martin.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden