chsvlib
chsv helper source code

◆ vPrintfW_s()

int Chusov::String::vPrintfW_s ( const wchar_t *restrict  pszFormat,
va_list  ap 
)
noexcept

The function behaves identically to vPrintfW but with some security enhancements.

Parameters
[in]pszFormatis a pointer to a zero terminated wide string defining how to interpret data, passed as additional parameters, during the construction of the output. See PrintfW_s for the definition of the format lexemes.
[in]apis a variable argument list containing data used to construct an output string according to the format.
Returns
On success the function returns a number of characters of the output not counting the terminating zero. If an output, encoding or runtime constraint violation error occurs the function returns a negative value.
Remarks
The function behaves identically to vPrintfW except for the following explicit runtime constraints:
  1. The pszFormat pointer is not a NULL pointer.
  2. The 'n' format type specifier is not allowed (modified or not by additional flags, width, precision, size).
  3. Any pointer corresponding to the 's' or 'S' format type specifier must not be NULL.

If any of this constraints are violated the function will generate assertion and, if continue of execution is allowed, fail setting errno to EINVAL.

Remarks
The function implements security enhancements for the vPrintfW function just like vwprintf_s function, defined in the ISO/IEC TR 24731-1 standard, provides the same enhancements for the C99 [vwprintf] function.
See also
PrintfW_s;
vPrintfW;
vPrintfA_s.