1个回答
展开全部
这个核心代码。。。 完全不靠谱 不要了。
#include<stdio.h>
int main()
{
FILE *fpa, *fpb, *fpc, *fpt=NULL;
int a,b;
fpa=fopen("A","r");
fpb = fopen("B","r");
fpc=fopen("C","w");
if(fpa == NULL || fpb == NULL || fpc == NULL) return -1;
a = b = -1;
while(1)
{
if(a == -1) a = fgetc(fpa);
if(b == -1) b = fgetc(fpb);
if(a == -1 || b == -1) break;
if(a < b)
{
fputc(a, fpc);
a = -1;
}
else
{
fputc(b,fpc);
b = -1;
}
}
if(a != -1)
{
fpt = fpa;
fputc(a, fpc);
}
else if(b != -1)
{
fpt = fpb;
fputc(b, fpc);
}
while((a=fgetc(fpt)) != -1) fputc(a,fpc);
fcloseall();
}
追问
果然高手
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询