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;

}

原文链接: https://www.cnblogs.com/gaohai/p/7890354.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/264049

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月14日 下午4:15
下一篇 2023年2月14日 下午4:15

相关推荐