|
From: Chad S. <ho...@ho...> - 2000-12-06 18:51:00
|
>From: mpstarix <mps...@ya...>
>Reply-To: dev...@li...
>To: dev...@li...
>Subject: Re: [Dev-C++] int to string
>Date: Wed, 06 Dec 2000 19:22:51 +0100
>
>Try
>
>{
> char thestring[whatever]
>
> sprintf(whatever,"John has %d apples,muInt);
>}
>
>sprintf applies a format and then puts the result into a string
Right, but then you are dealing with a static string, and not a dynamic one.
Which raises issues of buffer overflows, etc. As long as you know the length
of the buffer cannot be exceeded you're ok. But it's often dificult to be
sure. The standard C++ string and strstream classes prevent such overflowing
by handling the memory allocation internally.
Chad Simmons
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
|