This documentation is archived and is not being maintained.


Allocates a specific amount of bytes for the CSimpleStringT object.

void Preallocate( 
   int nLength 


The exact size of the CSimpleStringT character buffer in characters.

Call this method to allocate a specific buffer size for the CSimpleStringT object.

CSimpleStringT generates a STATUS_NO_MEMORY exception if it is unable to allocate space for the character buffer. By default, memory allocation is performed by WIN32 API functions HeapAlloc or HeapReAlloc.

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

CSimpleString str(pMgr);

_tprintf_s(_T("Allocated length: %d\n"), str.GetAllocLength());
_tprintf_s(_T("Allocated length: %d\n"), str.GetAllocLength());

Header: atlsimpstr.h