chsvlib
chsv helper source code

◆ GetUniqueString()

bool Chusov::String::GetUniqueString ( CHAR_TYPE *  lpStr,
std::size_t  cchStr 
)
noexcept

Generates an UUID as a C string and writes it into the output buffer.

Template Parameters
CHAR_TYPEis a type of the output buffer. Currently the template is defined only for CHAR_TYPE=char and CHAR_TYPE=wchar_t resolving to GetUniqueStringA and GetUniqueStringW respectively.
Parameters
[out]lpStris a pointer to the buffer holding the string on output. Its size must not be less then GUID_LENGTH + 1.
cchStris a capacity of the output buffer. This value must not be less then GUID_LENGTH + 1 for the buffer to be able to hold the UUID as a string together with the terminating zero character. The size is given in bytes for CHAR_TYPE=char, and in wide characters for CHAR_TYPE=wchar_t.
Returns
The function returns true on success and false on failure. Use GetLastChsvError to get extended error information.
Remarks
The string is returned in format "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" plus the terminating zero as the last character.
See also
AllocateUniqueString;
AllocateUniqueTempFileName.