RE: Problem mac os X version 10.6 when using sprinft
RE: Problem mac os X version 10.6 when using sprinft
- Subject: RE: Problem mac os X version 10.6 when using sprinft
- From: paul morel <email@hidden>
- Date: Mon, 10 May 2010 17:54:33 +0200
- Importance: Normal
Hi everybody,thanks a lot for your help. Actually you were right it size a problem of size. I increased the size and it works. The size was 20 because I thought that '\t' or other thing like that were considered directly as the 'final value', i.e. a space for example. And the value of n1 is 3. But what is weird is that it seems that with Mac OS X 10.5 there is no problem, whereas when I use Mac OS 10.6 the problem occurs. Anyway i understand now,Thank a lot for you help,
Regards,Paul
> From: email@hidden
> To: email@hidden; email@hidden
> CC: email@hidden; email@hidden
> Subject: Re: Problem mac os X version 10.6 when using sprinft
> Date: Fri, 7 May 2010 19:27:57 -0400
>
> On Fri, 7 May 2010 21:50:46 +0100, Alastair Houghton said:
>
> >On 7 May 2010, at 21:16, Sean McBride wrote:
> >
> >> Also, you should never use sprintf. Use snprintf instead.
> >
> >snprintf() is safer, certainly, but "never" is a little strong for my
> >taste. Like goto or longjmp(), it depends who is using it and what for.
>
> Well, yes, there's an exception to every rule (even this one). :)
>
> But really, sprintf is more evil than goto, especially since snprintf
> can be easily substituted. Using sprintf is risking exploitable buffer
> overflows, a common security problem, especially if the string is user-
> input. See also:
> <http://developer.apple.com/mac/library/documentation/Security/
> Conceptual/SecureCodingGuide/Articles/BufferOverflows.html#//apple_ref/
> doc/uid/TP40002577-SW10>
>
> >*Anyway*, this is cocoa-dev, and that being the case, this entire
> >question is off-topic. So to bring it back *on* topic, a better
> >alternative would be to use NSString's -stringWithFormat: method, which
> >is safer than sprintf() or snprintf(), and means you get an NSString
> >object which is a much richer type than a plain C string. -
> >stringWithFormat: also supports pretty much the same set of specifiers
> >that printf() does, with the addition of %@, of course.
> >
> >Oh, and there's also NSNumberFormatter if you want to format numbers in
> >a more sophisticated manner.
>
> Agreed!
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng email@hidden
> Rogue Research www.rogue-research.com
> Mac Software Developer Montréal, Québec, Canada
>
>
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969_______________________________________________
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