NSString's stringWithFormat:, or using sprintf/asprintf with the %d format:

char * str;

if(asprintf(&str, "%d", intval) < 0)
        //error

CGContextShowTextAtPoint...

free(str);

or if you know the possible max size of the text:

char strbuffer[MAX];

if(snprintf(strbuffer, MAX, "%d", intval) < 0)
        //error

CGContextShowTextAtPoint...


On May 25, 2009, at 1:16 AM, Pierre Berloquin wrote:

I need to display an int with  CGContextShowTextAtPoint
that only accepts char arrays.
How do I go about it ?
I can't find how to convert an int into a char* in objective-C !!

_______________________________________________

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