chsvlib
chsv helper source code

◆ snPrintf()

int Chusov::String::snPrintf ( CHAR_TYPE *restrict  pDest,
std::size_t  cchDest,
const CHAR_TYPE *restrict  pszFormat,
  ... 
)
noexcept

Resolves to snPrintfA or to snPrintfW depending on the template parameter.

Template Parameters
CHAR_TYPEis a template parameter specifying a type of strings the template specialization is to work with. That is CHAR_TYPE=char for multibyte strings in the current locale or CHAR_TYPE=wchar_t for wide strings. The corresponding functions, wrapped over by the template specializations, are snPrintfA and snPrintfW.
Parameters
[out]pDestis a pointer to the output buffer where the converted string is to be written to. A size, in characters, of the buffer is specified by cchDest.
[in]cchDestis a size, in characters, of the output buffer. If cchDest is zero, pDest may be a null pointer. At most \((cchDest - 1)\) characters of the formatted string are written to the output buffer. A zero terminator is always appended to the end of the output string.
[in]pszFormatis a pointer to a zero terminated string defining how to interpret data, passed as additional parameters, during the construction of the output.
...constitute an optional set of additional parameters to build the formatted output according to pszFormat.
Returns
On success the function returns a number of characters that would have been written had cchDest been sufficiently large, not counting the terminating zero. If an error occurs the function returns a negative number setting the corresponding errno code.

See snPrintfA and snPrintfW for the details.