linux c/c++ 获取文件大小

linux c/c++ 获取文件大小

#include <sys/stat.h>
int FileSize(const char* fname)
{
    struct stat statbuf;
    if(stat(fname,&statbuf)==0)
        return statbuf.st_size;
    return -1;
}
posted @ 2019-01-12 12:02  JohnRed  阅读(4996)  评论(0编辑  收藏  举报