Mail Archives: djgpp/1997/10/18/08:32:25
Peter Palotas wrote:
> Is there a way to find out the length of the string that sprintf()
> will
> generate, without writing it anywhere? i.e. if I want to dynamically
> allocate the storage space for the string this would be very good
> (read
> essential) to know!
Unfortunately, there is no ANSI C way to do this. The method that most
people use for "safe" string operations is to do the operations in a
Very Large Buffer, then only copy the portion that is appropriate the
user buffer handed to the function. Ugly, but it works.
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://newton.alcyone.com/
San Jose, California, United States / icbm://+37.20.07/-121.53.38
\
"After each war there is a little / less democracy to save."
/ Brooks Atkinson
- Raw text -