How to Get the Length of File in C
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;
}
版权声明:本博文属于作者原创或从其他地方学习而来的博文,未经许可不得转载.