how can i convert CComBSTR to char*
-
hi please tell me good bye
-
hi please tell me good bye
Take a look at the ATL string conversion macros. Try something like: USES_CONVERSION; CComBSTR bstrText(_T("String to convert")); TCHAR* asciiText = W2T(bstrText); Note that this uses TCHAR* instead of char* so that you can compile as unicode. Use W2A if you want to use ASCII explicitly. These functions allocate storage on the stack so don't try to access the converted string outside local scope - copy it if you want to return it from a function.
-
Take a look at the ATL string conversion macros. Try something like: USES_CONVERSION; CComBSTR bstrText(_T("String to convert")); TCHAR* asciiText = W2T(bstrText); Note that this uses TCHAR* instead of char* so that you can compile as unicode. Use W2A if you want to use ASCII explicitly. These functions allocate storage on the stack so don't try to access the converted string outside local scope - copy it if you want to return it from a function.