| |||
| Home > The C and C++ Libraries > C library extensions > vsnprintf() | |||
The vsnprintf() function works almost
exactly like the ISO vsprintf() function, except that
the caller can specify the maximum size of the buffer. The return
value is the length of the complete formatted string that would
have been written if the buffer were big enough. Therefore, the
string written into the buffer is complete only if the return value is
at least zero and at most n-1.
The bufsize parameter specifies
the number of characters of buffer that
the function can write into, including the
terminating null.
<stdio.h> is an ISO header file, but
the function is prohibited by the ISO C library standard. It is, therefore, not
available if you use the compiler with the --strict option.