Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Allocates a specific amount of bytes for the CSimpleStringT object.
void Preallocate(
int nLength
);
Parameters
- nLength
The exact size of the CSimpleStringT character buffer in characters.
Remarks
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.
Example
The following example demonstrates the use of CSimpleStringT::Preallocate.
CSimpleString str(pMgr);
_tprintf_s(_T("Allocated length: %d\n"), str.GetAllocLength());
str.Preallocate(100);
_tprintf_s(_T("Allocated length: %d\n"), str.GetAllocLength());
Requirements
Header: atlsimpstr.h