Hello.. How can I read a link list from a file without reading a garbage node? I don't know much about how file works..
This is my code fragment:
for(p = A; flag != 1;)
{
*p = (LIST) malloc(sizeof(celltype));
if((fread(*p, sizeof(celltype), 1, fp)) == 0)
flag = 1;
p = &(*p)->next;
}
*p = NULL;
please help