Re: Using MAPM with Cocoa/ObjectiveC
Re: Using MAPM with Cocoa/ObjectiveC
- Subject: Re: Using MAPM with Cocoa/ObjectiveC
- From: Martin Stanley <email@hidden>
- Date: Fri, 3 Dec 2010 07:39:44 -0500
Duh!!! (Insert forehead slap here)
Thanks for the very quick response.
Martin
On 2010-12-02, at 11:47 PM, Stephen J. Butler wrote:
> Not at all familiar with this library but...
>
> On Thu, Dec 2, 2010 at 10:36 PM, Martin Stanley
> <email@hidden> wrote:
>> int digits3 = m_apm_significant_digits(mapm3);
>> char out3[digits3 + 2]; // add 1 for the sign and 1 for the decimal point
>
> What about space for the '\0' terminator?
>
>> m_apm_to_string(out3, DECIMAL_PLACES, mapm3);
>>
>> NSString *str = [NSString stringWithFormat:@"%s", out3];
>
> You'd be better here using +[NSString stringWithUTF8String:]. Or
> +[NSString stringWithCString:encoding:]. Or -[NSString
> initWithBytes:length:encoding:] and then you don't need the '\0' at
> the end.
_______________________________________________
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