long get_file_size(char *filename)
{
struct stat f_stat;
if( stat( filename, &f_stat ) == -1 )
return -1;
return f_stat.st_size;
}
long get_file_size(char *filename)
{
FILE *fp=NULL;
long flen=0;
if((fp= fopen(filename,"r"))==NULL)
{
return -1;//错误处理机制
}
fseek(fp,0L,SEEK_END);
flen=ftell(fp);
fclose(fp);
return flen;
}
阅读(1206) | 评论(0) | 转发(0) |