|
|
|
|
|
|
|
the GetRecord function, we cannot use the extraction operator (>>), which stops reading as soon as a whitespace character is found. For each string we must call the get function, followed by a call to the ignore function to consume the newline character. |
|
|
|
|
|
|
|
|
//******************************************************************
// IMPLEMENTATION FILE (reclist.cpp)
// This file implements the RecordList class member functions.
// List representation: an array of pointers to PersonnelData
// structs and an integer variable giving the current length
// of the list
//******************************************************************
#include reclist.h
#include <iostream.h>
#include <string.h> // For strcmp()
#include <stddef.h> // For NULL
// Private members of class:
// PersonPtr ptrList [MAX_EMPL]; Array of pointers
// int length; Number of valid pointers
// in ptrList
void GetRecord( ifstream&, PersonPtr ); // Prototype for helper
// function
//******************************************************************
RecordList::RecordList()
// Default constructor
// Postcondition:
// length == 0
{
length = 0;
}
//******************************************************************
RecordList::~RecordList()
// Destructor
// Postcondition:
// Structs pointed to by ptrList[0..length-1]
// are no longer on the free store
|
|
|
|
|
|