Chinaunix首页 | 论坛 | 博客
  • 博客访问: 20276
  • 博文数量: 14
  • 博客积分: 433
  • 博客等级: 下士
  • 技术积分: 145
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-16 23:07
文章分类

全部博文(14)

文章存档

2012年(14)

最近访客

分类: C/C++

2012-05-08 12:51:15


点击(此处)折叠或打开

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

  3. int main(){
  4.     FILE *fp1,*fp2;
  5.     fp1=fopen("D:\\lena.bmp","rb");
  6.     fp2=fopen("D:\\my.bmp","wb");
  7.     if(!fp1||!fp2)
  8.         exit(-1);
  9.     fseek(fp1,0,SEEK_END);
  10.     int flen=ftell(fp1);
  11.     fseek(fp1,0,0);
  12.     unsigned char i;
  13.     for(int j=0;j<flen;j++){
  14.         fread(&i,sizeof(unsigned char),1,fp1);
  15.         fwrite(&i,sizeof(unsigned char),1,fp2);
  16.     }
  17.     fclose(fp1);
  18.     fclose(fp2);
  19.     return 0;
  20. }

http://blog.csdn.net/zhangxiaonanwin/article/details/6102430
阅读(186) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~