c
char* utf8 = NULL;
BOOL result = AllocateAndConvertWCharToUtf8(wchar, *pLength, &utf8, &utf8_len);
if (!result) {
    // Handle error: allocation or conversion failed
    return FALSE;
}
