Re: Converting uint16_t port to a NSString
Re: Converting uint16_t port to a NSString
- Subject: Re: Converting uint16_t port to a NSString
- From: Andrew Farmer <email@hidden>
- Date: Tue, 5 Jun 2007 01:41:44 -0700
On 05 Jun 07, at 01:13, Alexander Hartner wrote:
I am trying to construct an NSString from a set of different
component. For some reason I am having problems converting a
uint16_t correctly. In my tests it should convert the value 58080
to "58080". On PPC this has worked correctly, but on intel it
converts it to 57570. I figure is something I am doing wrong
related to stringWithFormat. I already tried using %i, %u %hu, but
they all see to produce the same result.
It has nothing to do with your formatting call - it's an endian
problem. I don't know where you're getting the value from, but it's
in network byte order, not host byte order. These are identical on
PPC, but not on Intel.
_______________________________________________
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