void putDataInBook(addressBookType& addType) {
ifstream input_file();
char file[40];
string f1, l1, adds, c, st, code, num, relation;
int mth, day, yr, count=0;
extPersonType extPerson;
cout << "Please enter the file name: ";
cin>>file;
input_file.open(file);
if(!input_file) {
cout << "The file name you entered seems not is not valid."<<endl;
}
getline(input_file, f1);
getline(input_file, l1);
input_file>>mth>>day>>yr;
getline(input_file, adds);
getline(input_file, c);
getline(input_file, st);
getline(input_file, code);
getline(input_file, num);
getline(input_file, relation);
while(input_file) {
extPerson.setData2(f1, l1, mth, day, yr, adds, c, st, code, num, relation);
addType.insertAt(count, extPerson);
count++;
input_file >> f1 >> l1 >> mth >> day >> yr;
getline(input_file, adds);
getline(input_file, c);
getline(input_file, st);
getline(input_file, code);
getline(input_file, num);
}
}
void diskData(addressBookType& addType) {
ofstream output_file;
char file[40];
cout << "Please enter a file name." << endl;
output_file.open(file);
if(!output_file) {
cout<<"The file does not exist.."<<endl;
}
addType.diskData(output_file);
}
以下是我的错误:
main2.cpp:128: error: no matching function for call to ‘getline(std::ifstream (&)(), std::string&)’
main2.cpp:129: error: no matching function for call to ‘getline(std::ifstream (&)(), std::string&)