I once made a script in C to receive a file name as argument in *argv and using fopen i would read each char until EOF. At the same time i would be calculating its size using sums.

I cant remeber how much i would sum for each char i read, but that method was very ineficient and slow.

Are there better examples of how to do it?