使用fgetc()函数读取文件大小
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char** argv)
{
FILE *fp;
int count;
if( argc < 2 )
{
fprintf(stderr,"Usage...\n");
}
fp = fopen(argv[0],"r");
if( fp == NULL )
{
perror("fopen()");
exit(1);
}
while(fgetc(fp) != EOF)
{
count++;
}
printf("count=%d\n",count);
fclose(fp);
exit(0);
}