鱼C论坛

 找回密码
 立即注册
查看: 1957|回复: 0

[技术交流] Linux版的图片文件合成器

[复制链接]
发表于 2021-7-12 10:42:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. #include <stdio.h>
  2. #include <stdlib.h>

  3. typedef FILE *pFILE;

  4. static
  5. void Usage ( void ) {
  6.         fprintf(stderr, "Usage: Image/Picture, Any/File, OutFileName.\n");
  7.         exit(0);
  8. }

  9. int main ( int argc,char *argv [] )
  10. {
  11.         pFILE fargImage = NULL,
  12.               fargFile  = NULL,
  13.               fargOutFile = NULL;
  14.         char wCharacter;

  15.         /*
  16.         * If it is the first one, argv [0] should be the name of the program
  17.         * itself, indicating that there is no other file name
  18.         */
  19.         if (argc == 1)                                 {
  20.                 Usage();
  21.         } if ( !( fargImage = fopen(argv[1], "rb") ) )         {
  22.                 printf("Not Found Image File!\n");
  23.                 Usage();
  24.         } if ( !( fargFile = fopen(argv[2], "rb") )  )         {
  25.                 printf("Not Found File!\n");
  26.                 Usage();
  27.         } if ( !( fargOutFile = fopen(argv[3], "wb") ) )       {
  28.                 printf("Not Found Out File!\n");
  29.                 Usage();[font=Times New Roman][/font]
  30.         }

  31.         while ( !( feof(fargImage) ) )
  32.         {
  33.                 wCharacter = fgetc(fargImage);
  34.                 fputc(wCharacter, fargOutFile);
  35.         }
  36.         fclose(fargImage);

  37.         while ( ! (feof(fargFile) ) )
  38.         {
  39.                 wCharacter = fgetc(fargFile);
  40.                 fputc(wCharacter, fargOutFile);
  41.         }

  42.         fclose(fargFile);
  43.         fclose(fargOutFile);
  44.         return 0;
  45. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-27 11:41

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表