共用方式為


CComBSTR::ByteLength

Returns the number of bytes in m_str, excluding the terminating null character.

unsigned int ByteLength( ) const throw( );

Return Value

The length of the m_str member in bytes.

Remarks

Returns 0 if m_str is NULL.

Example

// string with 11 chars (22 bytes)
CComBSTR bstrTemp(OLESTR("Hello World"));

unsigned int len = bstrTemp.ByteLength();

ATLASSERT(len == 22);   

Requirements

Header: atlbase.h

See Also

Reference

CComBSTR Class

CComBSTR::Length

Other Resources

CComBSTR Members