chsvlib
chsv helper source code

◆ AllocateAndFormatString()

CHAR_TYPE* Chusov::String::AllocateAndFormatString ( const CHAR_TYPE *restrict  lpszFormat,
  ... 
)
noexcept

Allocates a string buffer and initializes it according to the specified format parameters.

Template Parameters
CHAR_TYPEis a type of the allocated string. Currently the template is defined only for CHAR_TYPE=char and CHAR_TYPE=wchar_t resolving to AllocateAndFormatStringA and AllocateAndFormatStringW respectively.
Parameters
[in]lpszFormatis a zero-terminated string specified in the current locale giving the format of the output string. The format is specified according to the specification of the PrintfA_s function for CHAR_TYPE=char and of the PrintfW_s function for CHAR_TYPE=wchar_t.
...is a set of input data for the string parser according to the format string.
Returns
On success the function returns a pointer to the allocated and initialized string according to the format specified by the parameters. The returned string buffer must be freed using one of the free functions defined in the Chusov::Memory or Chusov::String namespaces. On failure the function returns NULL. Use GetLastChsvError function to get extended error information.
See also
AllocateString;
FreeString;
SecureFreeString;
AllocateAndFormatStringV;
AllocateAndFormatStringByTags.