获取文件大小的函数

long filesize( FILE *fp )
{
long int save_pos;
long size_of_file;

/* Save the current position. */
save_pos = ftell( fp );

/* Jump to the end of the file. */
fseek( fp, 0L, SEEK_END );

/* Get the end position. */
size_of_file = ftell( fp );

/* Jump back to the original position. */
fseek( fp, save_pos, SEEK_SET );

return( size_of_file );
}

posted @ 2016-04-07 10:38  hellohyi  阅读(819)  评论(0)    收藏  举报