I have CComBSTR in my code and have to pass it to function with argument type LPCSTR. How to convert CComBSTR to LPCSTR?
There are many ways to do this, but the ATL way would be using Using MFC MBCS/Unicode Conversion Macros:
void SomeCode()
{
USES_CONVERSION;
CComBSTR bstr(L"hello world");
LPCSTR lp = W2CA(bstr); // bstr is a LPWSTR
}