• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying a number with Quartz
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying a number with Quartz


  • Subject: Re: Displaying a number with Quartz
  • From: Michael Vannorsdel <email@hidden>
  • Date: Tue, 26 May 2009 07:34:55 -0600

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 (email@hidden)

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:
This email sent to email@hidden


References: 
 >Displaying a number with Quartz (From: Pierre Berloquin <email@hidden>)

  • Prev by Date: what am I missing with NSString ?
  • Next by Date: Re: what am I missing with NSString ?
  • Previous by thread: Re: Displaying a number with Quartz
  • Next by thread: NSWindow in threads
  • Index(es):
    • Date
    • Thread