Freigeben über


CAtlArray::GetData

Rufen Sie diese Methode auf, um einen Zeiger auf das erste Element im Array zurückzugeben.

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

Rückgabewert

Gibt einen Zeiger auf die Speicheradresse das erste Element im Array Speichern zurück. Wenn keine Elemente verfügbar sind, wird NULL zurückgegeben.

Beispiel

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

Anforderungen

Header: atlcoll.h

Siehe auch

Referenz

CAtlArray Class

CAtlArray::GetCount