#include <stdio.h>
#include <stdlib.h>typedef struct ST{
char name[10];
char address[20];
int age;
int mobile;
}St;
int main(int argc,char **argv)
{
FILE *datafp=NULL;
St st;
St *stp;
char flag;
int count;
char  *line="--------------------------------------------------------------------------------";
while(1){
printf("Please Input Your Name:"); /*
**check the input;
*/
if(scanf("%s",st.name)!=1)                   
{
printf("Invalidation Enter!\n");
exit(1);
}

printf("\nPlease Input Your Age:");
if(scanf("%d",&st.age)!=1)
{
printf("Invalidation Enter !\n");
exit(1);
}

printf("\nPlease Input Your Address:");
if(scanf("%s",st.address)!=1)
{
printf("Invalidation Enter !\n");
exit(1);
}

printf("\nPlease Input Your Mobile:");  
if(scanf("%d",&st.mobile)!=1)
{
printf("Invalidation Enter !\n");
exit(1);
}
//------------------------------------------------------------------------------------------------
/*
**print the infornation to let user check right or not
*/
printf("%s\nYour Information: name:%s age:%d address:%s mobile:%d\n\nCheck it whether it is right or not!\n%s\n", 
line,st.name,st.age,st.address,st.mobile,line);

printf("\nAre your finish your input(y/n)");
scanf("%s",&flag);
if(flag=='y')
{
/*
**Open file to input the data
*/
if((datafp=fopen("data.txt","w")==NULL))
{
printf("Open File Error!");
exit(1);
}
stp=&st;
if(!feof(datafp))
fwrite(stp,sizeof(St),1,datafp);
fclose(datafp);
break;
}
else{ 
continue;
count++;
}
}
}中的fwrite(stp,sizeof(St),1,datafp);这句话错在哪里,为什么当我运行到他的时候程序总是提出什么什么指令引用什么什么内存,不能read或不能written?请高手帮我看看,谢谢了,必给高分的。真的!!!