RE: Problem mac os X version 10.6 when using sprinft

2010-05-11 Thread paul morel
Well, I'll use the NSString and things like that it will be safer for sure but I just wanted to see where the problem came from. Anyway,thanks again for your help, Paul > Subject: Re: Problem mac os X version 10.6 when using sprinft > From: alast...@alastairs-place.net > Date: Mo

Re: Problem mac os X version 10.6 when using sprinft

2010-05-10 Thread Alastair Houghton
On 10 May 2010, at 16:54, paul morel wrote: > 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. See, that worries me. > The size was 20 because I thought that '\t' or other thing like that were > considered d

Re: Problem mac os X version 10.6 when using sprinft

2010-05-10 Thread Jens Alfke
On May 10, 2010, at 8:54 AM, paul morel wrote: > 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. Buffer overflows can be sneaky. The effect depends on exactly how variables are laid out in the stack (or if it’

RE: Problem mac os X version 10.6 when using sprinft

2010-05-10 Thread paul morel
bomber...@hotmail.com > CC: fri...@manoverboard.org; cocoa-dev@lists.apple.com > 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, S

Re: Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread Sean McBride
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

Re: Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread Alastair Houghton
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. *Anyway*, this is cocoa-dev, and that being th

Re: Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread Sean McBride
On Fri, 7 May 2010 15:03:31 -0500, Fritz Anderson said: >On 7 May 2010, at 2:00 PM, paul morel wrote: > >> sprintf(sFormat, "%%d\t%%0.%df\t%%0.%df\t%%0.%df\t%%0.%df\n", n1, n1, >n1, n1); > >You should also bear in mind that the printf() family lets you >parameterize widths and precisions dire

Re: Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread Fritz Anderson
On 7 May 2010, at 2:00 PM, paul morel wrote: > sprintf(sFormat, "%%d\t%%0.%df\t%%0.%df\t%%0.%df\t%%0.%df\n", n1, n1, > n1, n1); You should also bear in mind that the printf() family lets you parameterize widths and precisions directly by using "*" instead of a number, and supplying the n

Re: Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread Greg Parker
On May 7, 2010, at 11:59 AM, paul morel wrote: > Hi,I'm trying to use a c function: > sprintf(sFormat, "%%d\t%%0.%df\t%%0.%df\t%%0.%df\t%%0.%df\n", n1, n1, > n1, n1); > When I compile my program for Mac OS X 10.5 and run the program everything is > ok, whereas as soon as I use Mac OS X 10.6

Re: Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread Jens Alfke
On May 7, 2010, at 12:00 PM, paul morel wrote: > sprintf(sFormat, "%%d\t%%0.%df\t%%0.%df\t%%0.%df\t%%0.%df\n", n1, n1, > n1, n1); What’s the value of n1? How many bytes long is sFormat? Is the resulting string going to overflow it? To paraphrase Kyle, the debugger is your friend. —Jens_

Re: Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread Kyle Sluder
On Fri, May 7, 2010 at 11:59 AM, paul morel wrote: > Hi,I'm trying to use a c function: >        sprintf(sFormat, "%%d\t%%0.%df\t%%0.%df\t%%0.%df\t%%0.%df\n", n1, n1, > n1, n1); > When I compile my program for Mac OS X 10.5 and run the program everything is > ok, whereas as soon as I use Mac OS

Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread paul morel
Hi,I'm trying to use a c function: sprintf(sFormat, "%%d\t%%0.%df\t%%0.%df\t%%0.%df\t%%0.%df\n", n1, n1, n1, n1); When I compile my program for Mac OS X 10.5 and run the program everything is ok, whereas as soon as I use Mac OS X 10.6 the program crashes at this "sprintf" and there is a

Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread paul morel
Hi,I'm trying to use a c function: sprintf(sFormat, "%%d\t%%0.%df\t%%0.%df\t%%0.%df\t%%0.%df\n", n1, n1, n1, n1); When I compile my program for Mac OS X 10.5 and run the program everything is ok, whereas as soon as I use Mac OS X 10.6 the program crashes at this "sprintf" and there is a

Problem mac os X version 10.6 when using sprinft

2010-05-07 Thread paul morel
Hi,I'm trying to use a c function: sprintf(sFormat, "%%d\t%%0.%df\t%%0.%df\t%%0.%df\t%%0.%df\n", n1, n1, n1, n1); When I compile my program for Mac OS X 10.5 and run the program everything is ok, whereas as soon as I use Mac OS X 10.6 the program crashes at this "sprintf" and there is a