This documentation is archived and is not being maintained.

CSimpleStringT::CopyChars 

Copies a character or characters to a CSimpleStringT object.


static void CopyChars(
      XCHAR* pchDest,
   const XCHAR* pchSrc,
   int nChars
) throw( );

Parameters

pchDest

A pointer to a character string.

pchSrc

A pointer to a string containing the characters to be copied.

nChars

The number of pchSrc characters to be copied.

Call this method to copy characters from pchSrc to the pchDest string.

The following example demonstrates the use of CSimpleStringT::CopyChars.

{
    // ...

    CSimpleString str( "xxxxxxxxxxxxxxxxxxx", 20, pMgr );

    char* pszSrc= NULL;
    pszSrc= new char(12);
    if(pszSrc)
        pszSrc= "Hello world!";
    printf_s("%s\n", str);

    str.CopyChars(str.GetBuffer(), pszSrc, 12);
    printf_s("%s\n", str);

    // ...
}

Output

xxxxxxxxxxxxxxxxxxx
Hello world!xxxxxxx
Show: