高手帮小弟我看看这个程序,关于文件和链表的,小弟我刚刚学,不知道为什么,多谢了

高手帮我看看这个程序,关于文件和链表的,我刚刚学,不知道为什么,谢谢了!
[code=C/C++][#include<stdio.h>
#include<iostream>
using namespace std;
typedef struct node
{
  int Data;
  struct node *Next;
}slnodetype;

void Scan(slnodetype *h)
{  
slnodetype *p,*q;
int x;
FILE *fp;

if((fp=fopen("c:\\shuru.txt","r"))==NULL)
{
cout<<"Cant't open the file!"<<endl; exit(0);
}

p=h;
while(1)
{
if(feof(fp))
break;
cout<<"please enter number!"<<endl; fscanf(fp,"%d",&x);
p=(slnodetype *)malloc(sizeof(slnodetype));
p->Data=x;
q->Next=p;
q=p;
}
q->Next=NULL;
fclose(fp);
}
void Delete(slnodetype *h)
{
slnodetype *p,*q;
int min,max;
FILE *fp;

if((fp=fopen("c:\\del.txt","r"))==NULL)
{
cout<<"Cant't open the delete file !"<<endl;
exit(0);

}

  fscanf(fp,"%d%d",&min,&max);
fclose(fp);
p=h->Next;q=h;
while((p!=NULL) && (p->Data<max))
{
if(p->Data<=min)
q=p;
p=p->Next;
}
if(p!=q->Next)
q->Next=p;
else
cout<<"the delete data is not exit!"<<endl;

}

void Print(slnodetype *h)
{
slnodetype *p;
  FILE *fp;

if((fp=fopen("print.txt","w"))==NULL)
{
cout<<"Cant't open the print file !"<<endl;
exit(0);
}
p=h->Next;
cout<<"display the rest table !" <<endl;
if(p==NULL)
{
cout<<"the table is empty!"<<endl;
exit(0);

}
while(p!=NULL)
{
cout<<(p->Data)<< ">>>>";
p=p->Next;

}
fclose(fp);
}
 int main(void)
 {
slnodetype *h;
h=(slnodetype*)malloc(sizeof(slnodetype));
h->Next=NULL;
Scan(h);
Delete(h);
Print(h);
 }/code]
第一个问题:if((fp=fopen("c:\\shuru.txt","r"))==NULL)
{
  cout<<"Cant't open the file!"<<endl;
exit(0);
}
这个c:\\shuru需要自己在c盘建立新的txt文件还是,fopen()在无文件是可以自己建立的,我不在c盘建立shuru.txt,用vc运行结果是cant't open the file!所以应该是需要自己建立的吧,偶想。
我在c盘建立shuru.txt,用vc运行结果是:
please enter the number!
然后就出现了那个"0x00401654"指令引用的内存 "0xccccd0",该内存不能为空,要终止程序请按确定,要调试,请按取消。
小妹初学这个文件和链表这一块,不知道为什么呀,请哪位大神给偶解答一下,非常感谢!

------解决方案--------------------
先去DEBUG下问题语句再说吧.
------解决方案--------------------
fopen(...,"r") r方式文件必须存在

void Scan(slnodetype *h)
{
slnodetype *p,*q;
int x;
FILE *fp;

if((fp=fopen("c:\\shuru.txt","r"))==NULL)
{
cout<<"Cant't open the file!"<<endl; exit(0);
}

p=h;

你这个地方我猜应该是q = h吧,因为下边你的q根本没有分配内存~~