I'm using the itunes COM sdk and several of the functions return a BSTR(which is a visual basic string). to be able to use the result in say 'cout <<' it has to be converted but ALL examples i've found online havn't worked. I'm using borlands compiler bcc32. here's my code (with 2 of the ways i've found shown):
Code:
BSTR track_str = 0;
track->getArtist((BSTR *)&track_str);
//now if i display this i get something like '00xxxxxx' for the output
//1st method(must include comdef.h)
_bstr_t bstrt(track_str);
TCHAR szfinal[255];
_stprintf(szfinal, _T("%s"),(LPCSTR)bstrt);
//when i tried to compile i got an error: 'unresolved external  
__stdcall _com_util::ConvertBSTRToString(wchar_t *) referenced from myfile.obj

//### 2nd method
wstring wstr;
string strRet;
track->getArtist((BSTR *)&track_str);
wstr = track_str;
size_t len = wstr.size();
strRet.resize(len);
for (int j = 0; int j < len; j++)
{
    strRet[j] = static_cast<char>(wstr[j]);
}
//this method compiles, but when run the program crashes.