最近跟小甲鱼老师学了个很有意思的编程,可以吧文件隐藏在图片里,真好玩!!!
代码:
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp_pic, *fp_file, *fp_finish;
char ch, pic_name[20], file_name[20], finish_name[20];
printf("请输入图片和文件的名称(加上路径):/n");
printf("图片的名称(*.jpg):");
scanf("%s",pic_name);
printf("文件的名称(*.zip):");
scanf("%s",file_name);
printf("合成图片名称(*.jpg):");
scanf("%s",finish_name);
if(!(fp_pic=fopen(pic_name,"rb")))
{
printf("cannot open pic:%s",pic_name);
exit(1);
}
if(!(fp_file=fopen(file_name,"rb")))
{
printf("cannot open flie:%s",file_name);
exit(1);
}
if(!(fp_finish=fopen(finish_name,"wb")))
{
printf("cannot open finish:%s",finish_name);
exit(1);
}
while(!feof(fp_pic))
{
ch=fgetc(fp_pic);
fputc(ch,fp_finish);
}
fclose(fp_pic);
while(!feof(fp_file))
{
ch=fgetc(fp_file);
fputc(ch,fp_finish);
}
fclose(fp_file);
fclose(fp_finish);
printf("合成成功!!!/n");
system("pause");
return 0;
}