Re: Maybe we should use "snprintf" instead of "sprintf".

Justin Bradford (justin@ukans.edu)
Tue, 15 Jun 1999 20:01:23 -0500 (CDT)


> An "infinately long string" is easy to figure out, you figure out the number
> of characters the format string, and each of it's elements take up.
>
> If we wanted, we could even do a vsprintf() hack that would malloc() the
> string automatically. (Yes, I know there's a GNU extension that will do this
> already)

It's not quite as easy as it sounds. You basically have to rewrite *printf
functionality, which is quite a pain. I had to do something similar for a
webserver I wrote a while back. I wanted the module api to be able to do
*printf writes back to the client, but I had buffer overruns to worry
about.

If there's a nice GNU alternative, take that code. If not, I can
contribute the simple function I have (only %u, %i, %x, and %s, I believe
-- no formatting either).

Justin

P.S. The DSL line should be installed in 4-6 days now, so I'll be able to
pick up Word import/export development again. I hope to have have support
for both in by 1.0.



This archive was generated by hypermail 1.03b2.