chsvlib
chsv helper source code

◆ AllocateAndFormatStringByTags()

CHAR_TYPE* Chusov::String::AllocateAndFormatStringByTags ( const CHAR_TYPE *restrict  lpszTagFormatString,
unsigned int  cNumberOfTagsPresent,
  ... 
)

Allocates and initializes a multibyte string defined by format specified using PrintfA_s control sequences and user-defined tags.

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 AllocateAndFormatStringByTagsA and AllocateAndFormatStringByTagsW respectively.
Parameters
[in]lpszTagFormatStringis a zero-terminated string specifying format using PrintfA_s (if CHAR_TYPE=char) or PrintfW_s (if CHAR_TYPE=wchar_t) control sequences and tag words.
cNumberOfTagsPresentis a number of different tags specified in the format string and, therefore, a number of groups of entities of the variable parameters list. See AllocateAndFormatStringByTagsA and AllocateAndFormatStringByTagsW for further explanation.
...is a set of parameters for formatting the output. See See AllocateAndFormatStringByTagsA and AllocateAndFormatStringByTagsW for further explanation.
Returns
On success the function returns a pointer to the allocated memory holding the string constructed according to the specified format. The returned string buffer must be freed using one of the free functions defined in the chsvmem.h header. On failure the function returns NULL. Use GetLastChsvError function to get extended error information.
Remarks
See AllocateAndFormatStringByTagsA and AllocateAndFormatStringByTagsW for the explanations of usage and for examples.
See also
AllocateAndFormatStringByTagsV;
AllocateAndFormatStringByTagsIndirect;
AllocateString;
AllocateAndFormatString;
FreeString;
SecureFreeString.