共用方式為


IAtlStringMgr::Allocate

Allocates a new string data structure.

CStringData* Allocate( 
   int nAllocLength, 
   int nCharSize  
) throw( );

Parameters

  • nAllocLength
    The number of characters in the new memory block.

  • nCharSize
    The size (in bytes) of the character type used by the string manager.

Return Value

Returns a pointer to the newly allocated memory block.

Note

Do not signal a failed allocation by throwing an exception. Instead, a failed allocation should be signaled by returning NULL.

Remarks

Call IAtlStringMgr::Free or IAtlStringMgr::ReAllocate to free the memory allocated by this method.

Note

For usage examples, see Memory Management and CStringT.

Requirements

Header: atlsimpstr.h

See Also

Reference

IAtlStringMgr Class