You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
397 B
29 lines
397 B
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);
|
|
}
|