|
|
|
|
|
|
|
inFile.get(aPerson->workHistory, 201);
inFile.ignore(100, \n);
inFile.get(aPerson->education, 101);
inFile.ignore(100, \n);
inFile.get(aPerson->payrollData, 101);
inFile.ignore(100, \n);
}
//******************************************************************
void RecordList::ReadAll( /* inout */ ifstream& inFile,
/* out */ Boolean& outOfMem )
// Precondition:
// inFile has been opened for input
// && inFile contains at most MAX_EMPL records
// Postcondition:
// ptrList[0..length-1] point to dynamic structs
// containing values read from inFile
// && IF there was not enough free store for all input records
// outOfMem == TRUE
// && A warning message is printed
// ELSE
// outOfMem == FALSE
{
PersonPtr aPerson; // Pointer to newly input record
outOfMem = FALSE;
aPerson = new PersonnelData;
GetRecord(inFile, aPerson);
while (inFile && !outOfMem)
{
// Invariant (prior to test):
// ptrList[0..length-1] point to dynamic structs
// containing values read from inFile
// && 0 <= length <= MAX_EMPL
ptrList[length] = aPerson; // Store pointer into array
length++;
aPerson = new PersonnelData;
if (aPerson == NULL)
{
cout << ** Out of memory after << length
<< records have been input ** << endl;
outOfMem = TRUE;
|
|
|
|
|
|