chsvlib
chsv helper source code

◆ AllocateAndFormatStringW()

wchar_t* Chusov::String::AllocateAndFormatStringW ( const wchar_t *restrict  lpszFormat,
  ... 
)
noexcept

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

Parameters
[in]lpszFormatis a zero-terminated wide string specifying the format of the output string. The format is specified according to the specification of the PrintfW_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 multibyte strings for every wide string counterpart. The analogues are declared with an 'A' (instead of 'W') suffix at the end of the name, e.g. AllocateStringA, FreeStringA, etc.
See also
AllocateStringW;
FreeStringW;
SecureFreeStringW;
AllocateAndFormatStringVW;
AllocateAndFormatStringA;
AllocateAndFormatStringByTagsW.
Examples
chsvmem\AllocateAndFormatStringByTagsW.c.