chsvlib
chsv helper source code

◆ AllocateAndFormatStringV()

CHAR_TYPE* Chusov::String::AllocateAndFormatStringV ( va_list  ap,
const CHAR_TYPE *restrict  lpszFormat 
)
noexcept

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

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]apis a variable-argument list. It contains a list of the input data for the string parser according to the format string.
[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.
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 the GetLastChsvError function to get extended error information.
See also
AllocateString;
FreeString;
SecureFreeString;
AllocateAndFormatString;
AllocateAndFormatStringByTags.