CString::operators <<, >>

Syntax

friend CArchive& operator <<( CArchive& ar, const CString& string );
throw(CArchiveException);

friend CArchive& operator >>( CArchive& ar, CString& string );
throw(CArchiveException);

friend CDumpContext& operator <<( CDumpContext& dc, const CString& string );

Remarks

The CString insert (<<) operator supports diagnostic dumping and storing to an archive. The extract (>>) operator supports loading from an archive.

The CDumpContext operators are valid only in the Debug version of the Microsoft Foundation Class Library.

Example

// Operator << >> example

extern CArchive ar;

CString s( "abc" );

#ifdef _DEBUG

afxDump << s; // Prints the value (abc)

afxDump << &s; // Prints the address

#endif

if( ar.IsLoading() )

ar >> s;

else

ar << s;