Export (0) Print
Expand All

CComBSTR::operator +=

Appends a string to the CComBSTR object.

CComBSTR& operator +=(
   const CComBSTR& bstrSrc 
);
CComBSTR& operator +=(
   const LPCOLESTR pszSrc 
);

bstrSrc

[in] A CComBSTR object to append.

pszSrc

[in] A zero-terminated string to append.

CComBSTRs are compared textually in the context of the user's default locale. The LPCOLESTR comparison is done using memcmp on the raw data in each string. The LPCSTR comparison is carried out in the same way once a temporary Unicode copy of pszSrc has been created. The final comparison operator just compares the contained string against NULL.


CComBSTR bstrPre(OLESTR("Hello "));
CComBSTR bstrSuf(OLESTR("World!"));

// Appends "World!" to "Hello "
bstrPre += bstrSuf;

// Displays a message box with text "Hello World!"
::MessageBox(NULL, CW2CT(bstrPre), NULL, MB_OK);   


Header: atlbase.h

Community Additions

ADD
Show:
© 2014 Microsoft