CAtlArray::GetData

Call this method to return a pointer to the first element in the array.

E* GetData( ) throw( ); 
const E* GetData( ) const throw( );

Return Value

Returns a pointer to the memory location storing the first element in the array. If no elements are available, NULL is returned.

Example

// Define an array of integers
CAtlArray<int> MyArray;

// Define a pointer
int* pData;

// Allocate enough space for 32 elements
// with buffer increase to be calculated
// automatically
MyArray.SetCount(32, -1);

// Set the pointer to the first element
pData = MyArray.GetData();

// Set array values directly
for (int j = 0; j < 32; j++, pData++)
{
   *pData = j * 10;   
}

Requirements

Header: atlcoll.h

See Also

Concepts

CAtlArray Class

CAtlArray Members

CAtlArray::GetCount