|
发表于 2015-3-22 16:04:08
|
显示全部楼层
文件合成器我给你个代码:
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *pFr,*pF2,*pFw;
char a[30],b[30],n[30],c;
printf("请输入需要合成的文件1:\n");
scanf("%s",a);
if(!(pFr=fopen(a,"rb")))
{
printf("Can not open it");
return -1;
}
printf("请输入需要合成的文件2:\n");
scanf("%s",b);
if(!(pF2=fopen(b,"rb")))
{
printf("Can not open it");
return -1;
}
printf("请输入需要合成后的文件名:\n");
scanf("%s",n);
if(!(pFw=fopen(n,"wb")))
{
printf("Can not open it");
return -1;
}
c=getchar();
while(!feof(pFr))
{
c=fgetc(pFr);
fputc(c,pFw);
}
while(!feof(pF2))
{
c=fgetc(pF2);
fputc(c,pFw);
}
fclose(pFr);
fclose(pF2);
fclose(pFw);
system("pause");
return 0;
} |
|