Re: g_snprintf() implementation




On Tue, 20 Apr 1999, Miguel de Icaza wrote:
> 
> Please make sure this is well documented (ie, contribute to the glib
> documentation) and point out specifically that this is different from
> vsnprintf().  Seasoned developers might assume the standard snprintf
> behaviour. 
> 

Are the www.gtk.org/rdp docs in CVS?

Anyway, a "diff" for g_snprintf() and g_vsnprintf():

- The output is guaranteed to not exceed n characters,
+ The output is guaranteed to be '\0'-terminated and fit within 
+ n characters, including the '\0'. Unlike GNU snprintf(), never
+ fails to '\0'-terminate. 


- Returns: the length of the output string (some
- implementations return -1 if the output was truncated). 
+ Returns: the length of the output string not including '\0'.
+ Unlike GNU snprintf(), never returns -1. If n-1 is returned,
+ the string may have been truncated.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]