2个文件合并中间和结尾多出一个空格
#include <stdio.h>#include <conio.h>
#include <stdlib.h>
#include <windows.h>
main()
{
char ch[100],*p=ch;
FILE *fa,*fb,*fc;
if((fa=fopen("1.bin","rb"))==NULL)
{
printf("cannot open file A\n");
exit(0);
}
if((fb=fopen("2.bin","rb"))==NULL)
{
printf("cannot open file B\n");
exit(0);
}
if((fc=fopen("C.bin","wb"))==NULL)
{
printf("cannot open file C\n");
exit(0);
}
while(!feof(fa))
*p++=fgetc(fa);
while(!feof(fb))
*p++=fgetc(fb);
*p='\0';
fputs(ch,fc);
fclose(fa);
fclose(fb);
fclose(fc);
system("pause");
}
这样合并出来的文件在2个文件之间和最后会多个FF的空格出来,请问那2个空格应该怎么删掉?