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

相关文章:

  • 2022-12-23
  • 2022-02-08
  • 2021-12-14
  • 2021-05-23
  • 2022-01-06
  • 2022-12-23
  • 2021-12-13
  • 2021-09-22
猜你喜欢
  • 2022-12-23
  • 2022-02-03
  • 2021-06-29
  • 2021-07-20
  • 2021-12-20
  • 2022-12-23
  • 2021-12-25
相关资源
相似解决方案