hi guys!!!
ive been making this program thats supposed to store a number of records to a binary file.the problem ive encountered is with placing a record in a temporary object so that i can later on work on that data.i defined a class for this purpose as follows:
class temp
{
public:
char farmerName[20];
long idNumber;
long accountNumber;
char location[30];
};
and passed on the info from the file as follows:
// function to edit the farmer details...
void Farmer::editFarmer()
{
fstream myfile("Farmer.dat",ios::in | ios::out | ios::binary) ;
temp temprec;
clrscr();
cout<<"\t\tYOU HAVE CHOSEN TO EDIT A RECORD \n";
cout<<"\t\t------------------------------------\n\n";
while(myfile>>farmerName>>idNumber>>accountNumber>>location)
{
temprec.farmerName=farmerName;
//error raised on previous line:Lvalue required
temprec.idNumber=idNumber;
temprec.accountNumber=accountNumber;
temprec.location=location;
//error raised on previous line:Lvalue required
}
}
the error ive been gettting is been raissed when i pass the farmername and the location variables which are both of type char.the rest seems to be working fine ...its just those 2 lines!!!
so ....anyone??