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.

32 lines
457 B

6 years ago
void add()
{
int i,m=0;
char n;
char ch[2];
FILE *fp;
if((fp=fopen("data.txt","ab+"))==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
exit(0);
}
fseek(fp,0L,2);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: \n");
scanf("%s",inf[m].word);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%s",inf[m].mean);
if(fwrite(&inf[m],LEN,1,fp)!=1)
{
printf("<EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD><EFBFBD>");
getchar();
}
else
{
printf("<EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>");
scanf("%c",&n);
if(n=='Y'||n=='y')
add();
m++;
}
fclose(fp);
}