#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
FILE *one;
FILE *two;
char file1[20];
char file2[20];
printf("enter first file");//获取两个文件
gets(file1);
printf("enter the other file");
gets(file2);
one=fopen(file1,"r+");
two=fopen(file2,"r+");
char ch,sh;
if(one==NULL||two==NULL)
{
printf("错误!");
exit(1);
}
int i=0;
fseek(one, -1L, SEEK_END);//从文件末尾倒退一个,vim自己加了换行,这个步骤刚好去掉
while(fscanf(two,"%c",&ch)!=EOF)
fprintf(one,"%c",ch);
rewind(one);//回到文件开头
while((ch=fgetc(one))!=EOF)
putchar(ch);
fclose(one);
fclose(two);
return 0;
}