list* read(string fn){
ifstream file(fn);
node* no;
string temp;
lista* bn;
bn = new list;
if (file.is_open()){
if (bn->head == NULL) //if list is empty
{
no = new node;
file >> no->data;
no->prev = NULL;
no->next = NULL;
bn->head = no;
bn->tail = no;
}
while (file.is_open()){
no = new node;
file >> no->data;
no->next = NULL;
no->prev = bn->tail;
bn->tail->next = no; //here is where i get the error
bn->tail = NULL;
if (file.eof()){file.close();}
}
}
else { cout << "Unable to open file"; }
return bn;
}
no = new node; // new node created
file >> no->data; //data passed to it
no->next = NULL; //there is nothing in front of the node
no->prev = tailz; // Behind the new node will be the tail
tailz->next = no; // in front of the tail will be the new node
tailz = no; // now the new node is the tail
tailz->next = NULL; // there is nothing in front of the tail