> This has been a long standing problem for a long time. Does there
> exist a function call which can count the number of characters that a
> sprintf *will* generate without actually doing the sprintf. Could be
> CPU expensive, but with it we could create a function which would be a
> combination of sprintf/strdup (i.e. create a formatted string from
> dynamic storage). That would plug this type of hole forever.
Use C++ ostrstreams. This is one of the major shortcomings of C. It,
along with constructors and destructors are the reason I do all large (>300
lines) projects in C++.