|
|
发表于 2012-5-17 12:16:13
|
显示全部楼层
//只是合并顺序反了,jpg文件放在前,rar文件放在后面。并且貌似不能合并其他类型的文件
#include <stdio.h>
#include <stdlib.h>
void main()
{
char ch,fromfile[40],tofile[40],finalfile[40];
FILE *fp1,*fp2,*fp;
printf("please input the filename you want to copy from:");
scanf("%s",fromfile);
if (!(fp1=fopen(fromfile,"rb")))
{
printf("illegal input,cann't find!");
exit(0);
}
printf("please input the filename you want to copy to:");
scanf("%s",tofile);
if (!(fp2=fopen(tofile,"rb")))
{
printf("illegal input,cann't find!");
exit(0);
}
printf("please input the final filename you want to define:");
scanf("%s",finalfile);
fp=fopen(finalfile,"wb");
while (!feof(fp1))
{
ch=fgetc(fp1);
fputc(ch,fp);
}
fclose(fp1);
while (!feof(fp2))
{
ch=fgetc(fp2);
fputc(ch,fp);
}
fclose(fp2);
fclose(fp);
system("pause");
} |
|