#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int input();
int main()
{
input();
getchar();
system("pause");
return 0;
}
int input()
{
FILE *fp;
int i, m, flag = 1;
printf("请输入等级学生信息的总行数:");
scanf_s("%d", &m);
//你可以用scanf,我用的VS2017所以麻烦一点
while (flag)
{
fp = fopen("F:\stuinfo.txt", "w");
//errno_t err = (fopen_s(&fp, "F:\stuinfo.txt", "w"));
if (fp == 0)
{
printf("文件打开错误\n");
exit(0);
}
for (i = 0; i < m; i++)
{
scanf("%s", &students[i].stu_no);
fputs(students[i].stu_no, fp);
fputs("\t", fp);
}
fclose(fp);
}
return 0;
}