Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
CString::CString
CString                                     Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  CString();
  CString(const CString& stringSrc )
  throw( CMemoryException );
  CString( const char* psz )
  throw( CMemoryException );
  CString( char ch, int nRepeat = 1 )
  throw( CMemoryException );
  CString( const char* pch, int nLength )
  throw( CMemoryException );
  CString( const char FAR* lpsz )
  throw( CMemoryException );
  CString( const char FAR* lpch, int nLength )
  throw( CMemoryException );
 
  Parameter   Description
 
  <stringSrc> An existing CString object to be copied into this CString
              object.
 
  <psz>       A null-terminated string to be copied into this CString
              object.
 
  <ch>        A single character to be repeated <nRepeat> times.
 
  <nRepeat>   The repeat count for <ch>.
 
  <pch>       A pointer to an array of characters of length <nLength>, not
              null-terminated.
 
  <nLength>   A count of the number of characters in <pch>.
 
  <lpsz>      A far pointer to a null-terminated ASCII string.
 
  <lpch>      A far pointer to an array of characters of length
              <nLength>.
 
  Remarks
 
  Each of these constructors initializes 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, a char* where a CString object is
  expected.
 
  Example
 
  CString s1;                   // Empty string
  CString s2( "cat" );            // From a C string literal
  CString s3 = s2;              // Copy constructor
  CString s4( s2 + " " + s3 );    // From a string expression
 
  CString s5( 'x' );              // s5 = "x"
  CString s6( 'x', 6 );           // s6 = "xxxxxx"
 
  CString city = "Philadelphia"; // NOT the assignment operator
 
 
  See Also
 
  CString::operator =, CString Exception Cleanup
 
 
                                     -♦-