chsvlib
chsv helper source code

◆ AllocateAndFormatStringA()

char* Chusov::String::AllocateAndFormatStringA ( const char *restrict  lpszFormat,
  ... 
)
noexcept

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

Parameters
[in]lpszFormatis a zero-terminated multibyte 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.
...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 namespace. On failure the function returns NULL. Use GetLastChsvError function to get extended error information.
Remarks
The function is actually implemented as a wrap over the AllocateData function therefore it has analogous call rules as the other allocation functions of the Chusov::Memory namespace.
The Chusov::String namespace provides analogous functions for wide strings for every counterpart working with multibyte strings. The analogues are declared with a 'W' (instead of 'A') suffix at the end of the name, e.g. AllocateStringW, FreeStringW, etc.
See also
AllocateStringA;
FreeStringA;
SecureFreeStringA;
AllocateAndFormatStringVA;
AllocateAndFormatStringW;
AllocateAndFormatStringByTagsA.
Examples
chsvmem\AllocateAndFormatStringByTagsA.c.