#include <stdio.h>
main()
{   
int count=0;
    FILE *fp;	
	if((fp=fopen("fname.dat","r"))==NULL)
	{
printf("can¡¯t open file!\n");
        exit(0);
}
	 while(!feof(fp))
	{
fgetc(fp);
        count++;
}
printf("%d\n",count);	
fclose(fp);
}
