Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CString::operator =
CString                                     Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  const CString& operator =( const CString& stringSrc )
  throw( CMemoryException );
  const CString& operator =( const char* psz )
  throw( CMemoryException );
  const CString& operator =( char ch )
  throw( CMemoryException );
 
  Remarks
 
  The CString assignment operator (=) reinitializes an existing CString
  object with new data. If the destination string (that is, the left side)
  is already large enough to store the new data, no new memory allocation
  is performed.
 
  You should be aware that memory exceptions may occur whenever you use
  the assignment operator because new storage is often allocated to hold
  the resulting CString object.
 
  Example
 
  CString s1, s2;               // Empty CString objects
 
  s1 = "cat";                   // s1 = "cat"
  s2 = s1;                      // s1 and s2 each = "cat"
  s1 = "the " + s1;             // Or expressions
  s1 = 'x';                     // Or just individual characters
 
 
  See Also
 
  CString::CString
 
 
                                     -♦-