Hi, I am reading textfiles in a structure like this:
ifstream TextFile;
TextFile.open("quote.txt");
while (!TextFile.eof())
{
TextFile >> Quote[RecordNumber].RefNumber;
TextFile >> Quote[RecordNumber].Surname;
TextFile >> Quote[RecordNumber].Initials;
TextFile >> Quote[RecordNumber].TotalCost;
TextFile >> Quote[RecordNumber].DeliveryCost;
TextFile >> Quote[RecordNumber].Guarantee;
TextFile >> ws;
RecordNumber++;
}
TextFile.close();
However, this needs to be put into a function. I tried to do it by doing this: (the structure is defined as RecDetails Quote)
RecDetails ReadRecords (RecDetails Quote, int RecordNumber=0)
{
ifstream TextFile;
TextFile.open("quote.txt");
while (!TextFile.eof())
{
TextFile >> Quote[RecordNumber].RefNumber;
TextFile >> Quote[RecordNumber].Surname;
TextFile >> Quote[RecordNumber].Initials;
TextFile >> Quote[RecordNumber].TotalCost;
TextFile >> Quote[RecordNumber].DeliveryCost;
TextFile >> Quote[RecordNumber].Guarantee;
TextFile >> ws;
RecordNumber++;
}
TextFile.close();
}
However i get an error message saying "operator+ not implemented in type 'RecDetails' for arguments of type 'int'"
Any ideas what im doing wrong?