first commit

master
18783852161 6 years ago
parent 87665a7230
commit 8924c9ba51

@ -0,0 +1,28 @@
void add()
{
int i,m=0;
char n;
char ch[2];
FILE *fp;
if((fp=fopen("data.txt","ab+"))==NULL)
{
printf("文件不存在!\n");
exit(1);
}
fseek(fp,0L,2);
printf("请输入单词: \n");
scanf("%s",inf[m].word);
printf("请输入释义:\n");
scanf("%s",inf[m].mean);
if(fwrite(&inf[m],LEN,1,fp)!=1)
{
printf("不能保存");
getchar();
}
else
{
printf("已保存\n");
m++;
}
fclose(fp);
}
Loading…
Cancel
Save