修改了下...
open()
{
FILE *fp;
int i=0;
char s;
struct student stud,*st1,*st2;
pr("enter the filename:");
gets(filename);
if(!(fp=fopen(filename,"r"))) //执行到这就一直执行前面两条语句?
{
pr("no have the file\n"); /*打开文件*/
pr("do you want build a new file? y/n"); //语句要执行,但终端不输出?
s=getchar();
getchar();
if(s=='Y'||s=='y')
{
fp=fopen(filename,"w");
pr("add data now? y/n\n");
s=getchar();
getchar();
if(s=='Y'||s=='y') add();
}
return;
}
while(!feof(fp))
{
fread(&st1,SIZE,1,fp); /*读取文件*/
if(i==0) head=st1;
else st2->next=st1;
st2=st1;i++;
st2->next=0;
pr(ppp);
}
fclose(fp);
pr("you %d ge.\n",i+1);
getch();
}
为什么?
老板 地址:http://bbs.bc-cn.net/viewthread.php?tid=113964
[此贴子已经被作者于2007-1-4 14:21:00编辑过]