On 17/08/2009, at 5:07 PM, bosco fdo wrote:

I need NSString in binary format how do i print NSString in binary format
instead of "0001"
 obj-c code is uint8 barr[4];
barr[0] =(uint8)num;
barr[1] =(uint8)num>>8;
barr[2] =(uint8)num>>16;
barr[3] =(uint8)num>>24;

i am using [NSString stringwithFormat:@%i,barr[i]]

which %? i need to use to get the byte value(binary data) as it is from the
array?


This tells you:

http://www.opengroup.org/onlinepubs/009695399/functions/printf.html

It states that the default precision for %i is 1, but Apple appear to have changed it to 4 (???)

So try %i.1

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to