'\" t .\" Title: bstr_printf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Basic C Library Functions .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "BSTR_PRINTF" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "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" bstr_printf \- Format a string from binary arguments and place it in a buffer .SH "SYNOPSIS" .HP \w'int\ bstr_printf('u .BI "int bstr_printf(char\ *\ " "buf" ", size_t\ " "size" ", const\ char\ *\ " "fmt" ", const\ u32\ *\ " "bin_buf" ");" .SH "ARGUMENTS" .PP \fIbuf\fR .RS 4 The buffer to place the result into .RE .PP \fIsize\fR .RS 4 The size of the buffer, including the trailing null space .RE .PP \fIfmt\fR .RS 4 The format string to use .RE .PP \fIbin_buf\fR .RS 4 Binary arguments for the format string .RE .SH "DESCRIPTION" .PP This function like C99 vsnprintf, but the difference is that vsnprintf gets arguments from stack, and bstr_printf gets arguments from \fIbin_buf\fR which is a binary buffer that generated by vbin_printf\&. .PP The format follows C99 vsnprintf, but has some extensions: see vsnprintf comment for details\&. .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\&. .SH "COPYRIGHT" .br