first commit

master
18783852161 6 years ago
parent 76a0fcd008
commit 47fad6bf4d

@ -0,0 +1,31 @@
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void add()
{
int i,m=0;
char n;
char ch[2];
FILE *fp;
if((fp=fopen("data.txt","ab+"))==NULL)
{
printf("文件不存在!\n");
exit(0);
}
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("已保存");
m++;
}
fclose(fp);
}
Loading…
Cancel
Save