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("不能打开该地址文件,请检查 "); getchar(); return 0; } if (fp) { fseek(fp, 0, SEEK_END); siz = ftell(fp); fclose(fp); } siz/=1024.0; printf("该图片大小为 %ld kb ",siz); getchar(); return 0; }
原文地址:https://www.cnblogs.com/gaohai/p/7890354.html