Sun Java System Web Server 7.0 Update 3 NSAPI Developer's Guide

util_snprintf() Function

The util_snprintf function formats a specified string, using a specified format, into a specified buffer using the printf-style syntax and performs bounds checking. This function returns the number of characters in the formatted buffer.

For more information, see the documentation on the printf function for the runtime library of your compiler.


int util_snprintf(char *s, int n, char *fmt, ...);

Return Values

The number of characters formatted into the buffer.


char *s is the buffer to receive the formatted string.

int n is the maximum number of bytes allowed to be copied.

char *fmt is the format string. The function handles only %d and %s strings; it does not handle any width or precision strings.

... represents a sequence of parameters for the printf function.

See Also

util_sprintf() Function, util_vsnprintf() Function, util_vsprintf() Function