Vote count:
0
this is my student struct with the information I read in via binary
typedef struct student_t {
//data in here
} student_t;
This is what my fwrite looks like in my main. I keep getting a segmentation fault and all the examples that I have seen on how to write a doubly linked list to a binary file have you do this. So I come here for an explanation on why or maybe some changes to what I have. I also have my doubly linked list declared as listPtr in main, and my node as node.
node = listPtr->headPtr; //segmentation faults here
while(node!=NULL)
{
fwrite(node, sizeof(student_t), 1, file);
node=node->nextPtr;
}
any help on why this is happening would be greatly appreciated, I have never really written to a binary file with a doubly linked list :/.
asked 27 secs ago
fwriting a doubly linked list to a binary file segmentation faults
Aucun commentaire:
Enregistrer un commentaire