码迷,mamicode.com
首页 > 其他好文 > 详细

How to Get the Length of File in C

时间:2018-02-03 17:52:37      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:position   int   gpo   down   seek   blog   log   markdown   length   

How to get length of file in C

//===
int fileLen(FILE *fp)
{
    int nRet = -1;
    int nPosBak;

    nPosBak = ftell(fp);///< current position in file

    fseek(fp, 0, SEEK_END);
    nRet = ftell(fp);

    fseek(fp, nPosBak, SEEK_SET);///< write back position to file
    return nRet;
}

How to Get the Length of File in C

标签:position   int   gpo   down   seek   blog   log   markdown   length   

原文地址:https://www.cnblogs.com/zi-xing/p/7725492.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!