| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <stdio.h>
#include <stdarg.h>
int vsnprintf (char *buffer, size_t n, const char *format,
va_list ap);
|
This function works similarly to vsprintf() (see section vsprintf), but
the size n of the buffer is also taken into account. This
function will write n - 1 characters. The nth character is used
for the terminating nul. If n is zero, buffer is not touched.
The number of characters that would have been written (excluding the trailing nul) is returned; otherwise -1 is returned to flag encoding or buffer space errors.
The maximum accepted value of n is INT_MAX. INT_MAX is
defined in <limits.h>. -1 is returned and errno is set to
EFBIG, if n is greater than this limit.
| ANSI/ISO C | C89; C99 (see note 1) |
Notes: