Friday, July 3, 2009

Convert BSTR to char

wstring strLimitedSheetsTemp = SysAllocString(LimitedSheets);//LimitedSheets is BSTR
char* charVal= new char[strLimitedSheetsTemp.length() + 1];
wsprintfA(charVal, "%S", strLimitedSheetsTemp.c_str());

//free memory
delete [] charVal;
strLimitedSheetsTemp.clear();

No comments: