为用fread报错
int Load(){
ListNode *p = pHead;
ListNode *newNode = (ListNode*)malloc(sizeof(ListNode));
FILE *pf = fopen("d:\\1.txt", "r");
if (!pf)
{
puts("文件打开失败");
exit(0);
}
while (fread(p,1,sizeof(ListNode),pf))
{
newNode->data = pd;
newNode->pNext = NULL;
if (!p)
{
p= newNode;
return 0;
}
else
{
while (p->pNext)
{
p = p->pNext;
}
p->pNext = newNode;
}
}
fclose(pf);
return 1;
}
为什么只要走到 while (fread(p,1,sizeof(ListNode),pf))这步就报错,异常,请高手指点一下。