c/c++ 读取图片容量大小

//http://blog.csdn.net/lijia11080117/article/details/42042301?locationNum=10
#include "stdafx.h" #include<stdio.h> #include<stdlib.h> #include<Windows.h> #include<math.h> int _tmain(int argc, _TCHAR* argv[]) { FILE *fp; long siz; char path[100]="E://1.jpg"; //图片地址,我的图片放在E盘根目录 if((fp=fopen(path,"rb"))==NULL) { printf("不能打开该地址文件,请检查\n"); getchar(); return 0; } if (fp) { fseek(fp, 0, SEEK_END); siz = ftell(fp); fclose(fp); } siz/=1024.0; printf("该图片大小为 %ld kb\n",siz); getchar(); return 0; }

 

posted @ 2017-11-24 14:10  Henry2017  阅读(2225)  评论(0编辑  收藏  举报