loyaliser
asked on
Converting variables...
How do I copy a BSTR variable to a char variable?
How do I copy a char variable (of array type) to a BSTR variable?
How do I copy a char variable (of array type) to a BSTR variable?
What's a BSTR?
ASKER
BSTR is a COM variable type. I am building a COM in Visual C++ 6.0 and one of my functions accepts a parameter of type BSTR. I need to convert the BSTR variable to a char so that I can pass it to a function that accepts a char parameter.
That's it... make any sense? Thanks...
That's it... make any sense? Thanks...
ASKER
As far as I know BSTR is similar to the String data type, however, I don't know if it shares the same API methods.
the class _bstr_t defined in <comdef.h> automates the conversion from and to BSTR or char*.
intern the following functions are used:
BSTR _com_util::ConvertStringTo BSTR(const char* pSrc)
char* _com_util::ConvertBSTRToSt ring(BSTR pSrc)
bye,
feri
intern the following functions are used:
BSTR _com_util::ConvertStringTo
char* _com_util::ConvertBSTRToSt
bye,
feri
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah... I need the method that works in the ATL, because the code is within an ATL COM object.
Thanks...
Thanks...