# OS_VSNPrintfEx

## Syntax

  `#include <nitro/os.h>
  int OS_VSNPrintfEx( char *dst, size_t len, const char *fmt, va_list vlist );
  `

## Arguments

dst | Storage destination buffer for the output string.
len | Storage destination buffer size for the output string.
fmt | Output format string.
vlist | List containing a variable number of arguments.

## Return Values

Always returns the number of characters of a correctly output format string. The termination character (`\0`) is not included in this number.

The output string is written to dst. If the output string is less than len, the entire string and the terminator (`\0`) are written.
If the output string is greater than or equal to len AND
(1) len is not zero, the terminator (`\0`) is written to `dst[len - 1]`.
(2) len is zero, nothing is done to dst.

## Description

Returns the simplified version of the format string. This extends the features of the `OS_VSNPrintf` function and supports nonstandard conversion specifiers. The currently supported conversion specifiers are as follows.

- b, B:

  > Converts argument specified as unsigned `char` array elements to unsigned hexadecimal values. When `b` is specified, `abcedf` is used, and for `B`, `ABCDEF` is used. Precision can be specified before `b`/`B`. The precision dictates the number of bytes to display. If you use a period (`.`) when specifying precision, the value after the period indicates the number of bytes at which to wrap the line. When the precision is not specified, a single byte is output. To configure software to output a space or a colon (`:`) every byte, add a space or a colon (`:`) after `%` as a flag string.

  > Example:

  > `OS_TPrintfEx("%:6.3B\n", mac_address);
  > ` ↓
  > 00:09:BF<newline>12:34:56

This function is compiled with weak symbols. Therefore, you can overwrite them with your own function definitions.
However, this function may be used by TWL-SDK functions, high-level libraries, middleware, and other sources, so be careful not to change its behavior when you overwrite it.

## See Also

`OS_VSNPrintf
`

## Revision History

2009/03/27 Added a note on user-defined functions.
2006/10/23 Initial version.

CONFIDENTIAL