一切随风罢 发表于 2014-10-20 16:14:48

文件图片合成

#include<stdio.h>
#include<stdlib.h>
void main()
{
        FILE *f_pic,*f_file,*f_finish;
        char ch,pic_name,file_name,finish_name;

        printf("请输入文件名和图片名:\n");
        printf("图片:");
        scanf("%s",&pic_name);
        printf("文件:");
        scanf("%s",&file_name);
        printf("合成后:");
        scanf("%s",&finish_name);

        if(!(f_pic=fopen(pic_name,"rb")))
        {
                printf("cannot open the picther.");
                return;
        }
        if((f_file=fopen(pic_name,"rb"))==NULL)
        {
                printf("cannot open the file.");
                return;
        }
        if(!(f_finish=fopen(finish_name,"wb")))
        {
                printf("cannot open the file.");
                return;
        }
        while(!feof(f_pic))
        {
                ch=fgetc(f_pic);
                fputc(ch,f_finish);
        }
        fclose(f_pic);

        while(!feof(f_file))
        {
                ch=fgetc(f_file);
                fputc(ch,f_finish);
        }
        fclose(f_file);
        fclose(f_finish);
        system("pause");


}
为什么我将合成的文件改成rar文件后打不开。



大个的糖果 发表于 2014-10-30 20:00:48

页: [1]
查看完整版本: 文件图片合成