•// C++
•int *data;
•int numElements;
•
•void ReadData()
•{
• delete [] data;
// [] are important here, NULL can be passed
•
• ReadFile(…, &numElements, sizeof(numElements),
…);
• data = new int[numElements]; // you can pass 0 here
•
• if (data)
• {
• ReadFile(…, data, numElements*sizeof(data[0]),
…);
• }
•}
•