定义文件指针*/charfilename[20];/*定义文件名*/printf("\t保存到文件\n");/*输入文件名*/printf("\t请输入所保存的文件名:");scanf("\t%s",filename);if((fp=fopen(filename,"w"))==NULL){printf("\t无法打开文件\n");system("pause");return;}fprintf(fp,"******************************************通讯录******************************************\n");fprintf(fp,"学号姓名性别年龄电话号码通讯地址电子邮箱\n");fprintf(fp,"------------------------------------------------------------------------------------------\n");while(i<n){fprintf(fp,"%-3d\t%-6s\t%-6s\t%-6s\t%-13s\t%-20s\t%-20s\n",st[i].num,st[i].name,st[i].sex,st[i].age,st[i].tel,st[i].adds,st[i].email);i++;}fprintf(fp,"------------------------------------------------------------------------------------------\n");fprintf(fp,"***************************************共有%d条记录****************************************\n",n);