Conversion between 'CString' and 'BSTR'


BSTR (Basic string or binary string) is a string data type that is used by COM, Automation, and Interop functions. A BSTR is a composite data type that consists of a length prefix, a data string, and a terminator.

Use the AllocSysString member function of the CString to convert from CString to BSTR:

Code:
        CString cs("Hello");
        BSTR bstr = cs.AllocSysString();

Note: If you use the 'BSTR' by yourself, dont forget to call '::SysFreeString()' when you're done with it.

Comments

Popular posts from this blog

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

How to boot Samsung Galaxy SL( GT-I9003) in recovery mode

Exception handling with RestTemplate