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.

No comments:

Post a Comment

Golang: Http POST Request with JSON Body example

Go standard library comes with "net/http" package which has excellent support for HTTP Client and Server.   In order to post JSON ...