1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
void openFile(vector<Address>& record, Address& nAddress)
{
ifstream import;
string input;
int i = 0;
cout << endl;
import.open("address.txt");
while(getline(import, input))
{
getline(import, input, ';');
record[i].id = input;
getline(import, input, ';');
record[i].firstname = input;
getline(import, input, ';');
record[i].lastname = input;
getline(import, input, ';');
record[i].email = input;
getline(import, input, ';');
record[i].phone = input;
getline(import, input, ';');
record[i].unit = input;
getline(import, input, ';');
record[i].street = input;
getline(import, input, ';');
record[i].city = input;
getline(import, input, ';');
record[i].province = input;
getline(import, input, ';');
record[i].country = input;
getline(import, input);
record[i].postal = input;
record.push_back(nAddress);
i++;
}
import.close();
cout << "Import was succesful" << endl;
cout << endl;
|