//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; }