CAtlArray::GetData

调用此方法返回指向该数组中的第一个元素。

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

返回值

返回指向存储第一个元素的内存位置。数组。如果元素不可用,返回NULL。

示例

// 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;   
}

要求

Header: atlcoll.h

请参见

参考

CAtlArray选件类

CAtlArray::GetCount