chsvlib
chsv helper source code

◆ scPrintfW()

int Chusov::String::scPrintfW ( const wchar_t *restrict  pszFormat,
  ... 
)
noexcept

Returns a number of wide characters required to hold a string, given by PrintfW formatting parameters, not counting the terminating zero.

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 for the definition of the format lexemes.
...constitute an optional set of additional parameters to build the formatted output according to pszFormat.
Returns
On success the function returns a number of wide characters required to hold the formatted string except for the terminating null. On failure the function returns a negative number.

The function is introduced to provide a possibility to preallocate a buffer of a required size before calling a function that actually creates a formatted output.

The function is intended for use with the standard C functions, i.e. "non-secure" functions that are not introduced by the ISO/IEC TR 24731-1 standard specifying certain runtime constraints. For the "secure" functions use the scPrintfW_s function.

The function is a chsvlib extension over the functions of the PrintfW family that are implemented according to the C99 and C11 standards and have explicitly given standard equivalents. The function has an equivalent implemented as a part of Microsoft C Library - _scwprintf. Although the latter uses "secure" runtime constraints while the vscPrintfW function uses the rules common to the standard C functions.

See also
PrintfW;
sPrintfW;
scPrintfW_s;
scPrintfA.