CString::CString

Use these constructors to initialize a new CString object with the specified data.

Because the constructors copy the input data into new allocated storage, you should be aware that memory exceptions may result. Note that some of these constructors act as conversion functions. This allows you to substitute, for example, an LPTSTR where a CString object is expected.

Syntax

CString( );

CString( const CString& stringSrc );
throw( CMemoryException );

CString( TCHAR ch, int nRepeat = 1 );
throw( CMemoryException );

CString( LPCTSTR lpch, int nLength );
throw( CMemoryException );

CString( const unsigned char* psz );
throw( CMemoryException );

CString( LPCWSTR lpsz );
throw( CMemoryException );

CString( LPCSTR lpsz );
throw( CMemoryException );

At a Glance

Header File Afx.h
Platforms
Versions 1.0 and later
Complete documentation Visual C++ documentation

See Also

CString Overview, CString Member Functions, Simple Value Types, CString::operator =