Function stdio_snprintf
Defined in File printf.h
Function Documentation
-
int stdio_snprintf(char *s, size_t n, const char *format, ...)
An implementation of the C standard’s snprintf()
- Parameters:
s – An array in which to store the formatted string. It must be large enough to fit either the entire formatted output, or at least
n
characters. Alternatively, it can be NULL, in which case nothing will be printed, and only the number of characters which could have been printed is tallied and returned.n – The maximum number of characters to write to the array, including a terminating null character
format – A string specifying the format of the output, with %-marked specifiers of how to interpret additional arguments.
... – Additional arguments to the function, one for each specifier in
format
.
- Returns:
The number of characters that COULD have been written into
s
, not counting the terminating null character. A value equal or larger thann
indicates truncation. Only when the returned value is non-negative and less thann
, the null-terminated string has been fully and successfully printed.