360ITO技术社区
  • 首页
  • 文章
  • 快讯
  • 讨论
  • 问答
  • 小贴士
  • 代码块
  • 开源
  • 老论坛
登录 | 注册

360ITO技术社区  > 小贴士

订阅小贴士

linux c 语言获取文件大小

By smallghost at 7年前 , 2740 次点击  
Linux C/C++
#include <sys/stat.h> 
unsigned long get_file_size(const char *path)  
{  
    unsigned long filesize = -1;      
    struct stat statbuff;  
    if(stat(path, &statbuff) < 0){  
        return filesize;  
    }else{  
        filesize = statbuff.st_size;  
    }  
    return filesize;  
}  

热门标签

  • android 7
  • Python 5
  • Linux 4
  • 网站性能优化 2
  • delphi 2
  • C/C++ 1
  • git 1
  • SQLite 1
  • 屏幕 1
Copyright ©2011-2012 360ITO技术社区 All Rights Reserved. | 关于 | 联系我们 | 杭州精创信息技术有限公司 浙ICP备09019653号-26|
▲