xiaoshuai666 发表于 2016-9-3 19:21:02

文件图片合成器

我用合成器合成的图片,将图片与文本文档合一起,合成后的图片后缀为jpg,把后缀改成rar之后,解压打不开,解压提示:无法做为压缩文件打开,请问大神这是怎么回事?

程序源代码如下:
#include <stdio.h>
#include <stdlib.h>
void main()
{
      FILE *f_file, *f_pic, *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 ficture %s!\n", pic_name);
            exit(0);   // 终止程序
      }
      if( !(f_file = fopen(file_name, "rb")))
      {
            printf("Cannot open the file %s!\n", file_name);
            exit(0);   // 终止程序
      }
      if( !(f_finish = fopen(finish_name, "wb")))
      {
            printf("Cannot open the file %s!\n", finish_name);
            exit(0);    // 终止程序
      }
      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);
}
页: [1]
查看完整版本: 文件图片合成器