chsvlib
chsv helper source code

◆ sPrintf()

int Chusov::String::sPrintf ( CHAR_TYPE *restrict  pszDest,
std::size_t  cchDest,
const CHAR_TYPE *restrict  pszFormat,
  ... 
)

Resolves to sPrintfA or to sPrintfW 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 sPrintfA and sPrintfW. For the first case the function performs some additional checks equivalent to the ones performed by the sPrintfW function.
Parameters
[out]pszDestis a pointer to the output buffer where the converted string is to be written to.
[in]cchDestis a size of the output buffer, in characters, including the terminating zero. No more than that many characters are written to the buffer including the terminating zero which is always appended.
[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 written to the buffer not counting the terminating zero. If an error occurs the function returns a negative value.

See sPrintfA and sPrintfW for the details.