Share via


CSimpleStringT::Preallocate

지정한 만큼의 바이트를 할당 된 CSimpleStringT 개체입니다.

void Preallocate(
   int nLength
);

매개 변수

  • nLength
    정확한 크기는 CSimpleStringT 문자 버퍼에서 문자.

설명

특정 버퍼 크기를 할당 하는 데이 메서드를 호출 하 여 CSimpleStringT 개체입니다.

CSimpleStringT생성 된 STATUS_NO_MEMORY 문자 버퍼에 대 한 공간을 할당할 수 없는 경우 예외입니다.기본적으로 메모리 할당 WIN32 API 함수에 의해 수행 된 HeapAlloc 또는 HeapReAlloc.

예제

다음 예제는 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());

요구 사항

헤더: atlsimpstr.h

참고 항목

참조

CSimpleStringT 클래스