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

Shaw Terwilliger (sterwill@postman.abisource.com)
Tue, 15 Jun 1999 09:27:49 -0500


michael@surfnetcity.com.au wrote:
>
> On Tue, Jun 15, 1999 at 12:31:16PM +0800, Ming-I Hsieh wrote:
> > sprintf(buf,"%.4fin",value);
> > ^^^^^^^^^ here, if we use "snprintf" instead of
> > "sprintf". I think it will
> > more stable! :)
>
> Down near the bottom of the snprintf(3) man page:
>
> CONFORMING TO
> These are GNU extensions.

glib provides us g_snprintf(), but we're only using glib on
the Unix side. glib is very easily compiled on Windows but
I believe Windows also provides snprintf(). In Unix code, anyway,
I've tried to use g_snprintf() when buffer size is an issue, but
XP code poses a different problem.

-- 
Shaw Terwilliger


This archive was generated by hypermail 1.03b2.