Sun Java System Web Server 6.1 SP7 NSAPI Programmer's Guide


The util_sprintf function formats a specified string, using a specified format, into a specified buffer, using the printf-style syntax without bounds checking. It returns the number of characters in the formatted buffer.

Because util_sprintf doesn’t perform bounds checking, use this function only if you are certain that the string fits the buffer. Otherwise, use the function util_snprintf. For more information, see the documentation on the printf function for the runtime library of your compiler.


int util_sprintf(char *s, char *fmt, ...);


The number of characters formatted into the buffer.


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

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.


char *logmsg;int len;logmsg = (char *) MALLOC(256);len = 
util_sprintf(logmsg, "%s %s %s\n", ip, method, uri);

See Also

util_snprintf, util_vsnprintf, util_vsprintf