Re: How do you convert a byte array to a int or long, NSNumber has not byte init method.
Re: How do you convert a byte array to a int or long, NSNumber has not byte init method.
- Subject: Re: How do you convert a byte array to a int or long, NSNumber has not byte init method.
- From: "Shawn Erickson" <email@hidden>
- Date: Mon, 7 May 2007 11:21:17 -0700
On 5/7/07, Shawn Erickson <email@hidden> wrote:
On 5/7/07, Martin <email@hidden> wrote:
> 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}
UInt12 twoByteValue;
Oops... typo... make that UInt16.
_______________________________________________
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