I have problems with the order of read.
Thank you for replying I was starting to think nobody would.
I'm trying to input a freshly read binary file into a uncreated linked list. I have it simiworking. It reads the first name, last name, and ssnumber. It doesn't read the integers weight or age that have been read. Does it need to be inputed into the file in a certain order and read in a certain order?
Code:
void linklist::read()
{
initializeData();
ifstream instream("members.dat",ios::in);
if (!instream)
cout << "File could not be opened\n....";
else
{
while (!instream.eof()) //
{
link* newlink = new link;
initializeData();
instream>>buffer1>>buffer2>>buffer3;
instream>>weight>>age;
newlink->age=age;
newlink->weight=weight;
for(x=0;x<SIZE;x++)
{
newlink->fname[x] = buffer1[x];
}
for(x=0;x<SIZE;x++)
{
newlink->lname[x] = buffer2[x];
}
for(x=0;x<SIZE;x++)
{
newlink->ssnumber[x] = buffer3[x];
}
newlink->next = head;
if (head == NULL) //this tells me I have an empty list
{
head = newlink;
tail = head;
}
else
{
head = newlink;
}
}
}
instream.close();
}