• 一张有料的图片!!!附文件-图片合成器C语言实现算法


    凯鲁嘎吉 - 博客园

    http://www.cnblogs.com/kailugaji/

    1.打开F盘,先找两个文件,一个是压缩文件(2.rar),另一个是一张图片(1.jpg),将其放到F盘目录下,当然,其他盘也可以。

    1.jpg图片如下:

    2.rar文件里面的内容如下:

    2.打开cmd,输入命令

    C:Userslenovo>F:
    
    F:>copy /b 1.jpg+2.rar 凯鲁嘎吉.jpg

    3.再次查看F盘,发现多了一个文件(凯鲁嘎吉.jpg)

    4.它表面上看去是1.jpg,但请你将“凯鲁嘎吉.jpg”修改文件后缀名为“凯鲁嘎吉.rar”,神奇的事情发生了

    凯鲁嘎吉.rar里面的内容如下:

    它竟然和2.rar里面的内容一模一样!!!

    那么,如果你想拥有以上C语言的资料,请保存以下这张有料的图片,它真的有料!!!

    C语言实现算法:

     1 #include<stdio.h>
     2 #include<stdlib.h>
     3 void main(){
     4     FILE *f_pic,*f_file,*f_finish;
     5     char ch,pic_name[20],file_name[20],finish_name[20];
     6     printf("Please ipunt picture and file name:
    ");
     7     printf("picture:");
     8     scanf("%s",pic_name);
     9     printf("file:");
    10     scanf("%s",file_name);
    11     printf("生成为:");
    12     scanf("%s",finish_name);
    13 
    14     if(!(f_pic=fopen(pic_name,"rb"))){
    15         printf("Cannot open the picture %s !",pic_name);
    16         return;
    17     }
    18 
    19     if(!(f_file=fopen(file_name,"rb"))){
    20         printf("Cannot open the file %s !",file_name);
    21         return;
    22     }
    23 
    24     if(!(f_finish=fopen(finish_name,"wb"))){
    25         printf("Cannot open the picture %s !",finish_name);
    26         return;
    27     }
    28 
    29     while(!(feof(f_pic))){
    30         ch=fgetc(f_pic);
    31         fputc(ch,f_finish);
    32     }
    33 
    34     fclose(f_pic);
    35 
    36     while(!(feof(f_file))){
    37         ch=fgetc(f_file);
    38         fputc(ch,f_finish);
    39     }
    40 
    41     fclose(f_file);
    42     fclose(f_finish);
    43     system("pause");
    44 }

    当前目录下已有两个文件:

    结果:

    在当前目录下,同样生成一个图片文件 kailugaji.jpg

     是不是很神奇!!! 

    注意:C语言程序中1.jpg与2.rar应该与.c文件在同一目录下,生成的文件也是和.c文件在同一目录下!

  • 相关阅读:
    Missing Number
    python乱码,讲得比较好,
    公司搬家,拿了个费机器,没root密码,又忘了怎么搞了,
    mylyn
    eclipse shortcut binding
    jdk8 eclipse luna market crashed
    openjdk
    download plugin update site for offline installation
    armstrong's programming erlang 2nd
    sdf SimpleDateFormat 不是线程安全的,
  • 原文地址:https://www.cnblogs.com/kailugaji/p/8582785.html
Copyright © 2020-2023  润新知