• 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: What am I looking for in the documentation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What am I looking for in the documentation?


  • Subject: Re: What am I looking for in the documentation?
  • From: Rick Mann <email@hidden>
  • Date: Sat, 04 May 2013 16:32:47 -0700

You need to do a string conversion, just like you would in any situation where you need a textual version of a number.

One possible way:

	NSString* s = [NSString stringWithFormat: @"%.1f", fv];
	const char* sp = s.UTF8String;

another:

	char* s[16];
	snprintf(s, 16, "%.1f", fv);



On May 4, 2013, at 16:20 , YT <email@hidden> wrote:

> I have need to turn a local float value into a char array.
>
> That is, The Quartz 2D graphics function requires the passing of a (const char *) to a text string or I was thinking of a character array.
>
> My mind is mush at the moment - can't seem to recall the way to program a conversion of
>
> float fv = 40.0;
>
> into
>
> const char *text = "40.0";
>
> or
>
> const char text[ ] = "40.0";
>
>
> Please advise...
>
> Thanks YT
>
>
>
> _______________________________________________
>
> 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


--
Rick




_______________________________________________

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: 
 >What am I looking for in the documentation? (From: YT <email@hidden>)

  • Prev by Date: What am I looking for in the documentation?
  • Next by Date: Trouble linking libcommonCrypto in iOS 6.1
  • Previous by thread: What am I looking for in the documentation?
  • Next by thread: Re: What am I looking for in the documentation?
  • Index(es):
    • Date
    • Thread