'\" t .\" Title: vsnprintf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: June 2017 .\" Manual: Basic C Library Functions .\" Source: Kernel Hackers Manual 4.11.3 .\" Language: English .\" .TH "VSNPRINTF" "9" "June 2017" "Kernel Hackers Manual 4\&.11\&" "Basic C Library Functions" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" vsnprintf \- Format a string and place it in a buffer .SH "SYNOPSIS" .HP \w'int\ vsnprintf('u .BI "int vsnprintf(char\ *\ " "buf" ", size_t\ " "size" ", const\ char\ *\ " "fmt" ", va_list\ " "args" ");" .SH "ARGUMENTS" .PP \fIchar * buf\fR .RS 4 The buffer to place the result into .RE .PP \fIsize_t size\fR .RS 4 The size of the buffer, including the trailing null space .RE .PP \fIconst char * fmt\fR .RS 4 The format string to use .RE .PP \fIva_list args\fR .RS 4 Arguments for the format string .RE .SH "DESCRIPTION" .PP This function generally follows C99 vsnprintf, but has some extensions and a few limitations: .PP \fBn\fR is unsupported \fBp\fR* is handled by \fBpointer\fR .PP See \fBpointer\fR or Documentation/printk\-formats\&.txt for more extensive description\&. .PP ** Please update the documentation in both places when making changes ** .PP The return value is the number of characters which would be generated for the given input, excluding the trailing \*(Aq\e0\*(Aq, as per ISO C99\&. If you want to have the exact number of characters written into \fIbuf\fR as return value (not including the trailing \*(Aq\e0\*(Aq), use \fBvscnprintf\fR\&. If the return is greater than or equal to \fIsize\fR, the resulting string is truncated\&. .PP If you\*(Aqre not already dealing with a va_list consider using \fBsnprintf\fR\&. .SH "COPYRIGHT" .br