chsvlib
chsv helper source code

◆ AllocateStringW()

wchar_t* Chusov::String::AllocateStringW ( std::size_t  cch)
noexcept

Allocates an uninitialized string of the specified size, in wide symbols, plus a room for the terminating zero.

Parameters
cchis a size of the string to be allocated, in wide symbols excluding a terminating 0.
Returns
On success the function returns a pointer to the allocated wide string. The content of the allocated string is not specified. 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
AllocateData;
AllocateAndFormatStringW;
AllocateAndFormatStringByTagsW;
FreeStringW;
SecureFreeStringW.