I want to convert a vector string to BSTR and to V_BSTR but when i debug the output it shows some strange output. Below is the code which am trying.
vector<string> v = explode("*", Types);
VARIANT vHeads = { 0 };
BSTR Heads = SysAllocStringByteLen(v[0].c_str(), v[0].size());
V_VT( &vHeads ) = VT_BSTR;
V_BSTR( &vHeads ) = Heads;
char buff[1024];
sprintf_s(buff, "Vhead: %S And Head: %s", vHeads,Heads);
MessageBoxA(NULL, buff, "Debug", MB_OK | MB_ICONQUESTION);
The vhead output is some weird output but heads output is as expected. Can someone say what's wrong?