It should go without saying that the text char array you suggest must already
exist, and be at least one char longer than the longest string you expect (I'd
make it twice as long).
And use snprintf(3) instead. Bad People (or you) will try to overrun the buffer
if you don't prevent it. (Not
You might want to look at sprintf http://linux.die.net/man/3/sprintf.
sprintf(text, %f, fv) should work just fine.
On Sat, May 4, 2013 at 4:20 PM, YT y...@redwoodcontent.com wrote:
I have need to turn a local float value into a char array.
That is, The Quartz 2D graphics function requires
On Sat, 4 May 2013 16:20:14 -0700, YT said:
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
On May 6, 2013, at 09:03 , Sean McBride s...@rogue-research.com wrote:
Also consider localisation... do you absolutely want the '.' character, or
whatever decimal character is specified by the user's locale (or the user
himself)? Consider NSNumberFormatter if you want localisation.
Yes! I
On May 4, 2013, at 4:20 PM, YT y...@redwoodcontent.com 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.
Knowing which API you mean,
Thanks!
sprintf worked great - Didn't realize that those wonderful Standard C functions
were available.
Again, Thanks
YT
On May 4, 2013, at 4:23 PM, Mohit Sharma mohit.sharma0...@gmail.com wrote:
You might want to look at sprintf. sprintf(text, %f, fv) should work just
fine.
On
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
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,