I\'ve read posts that show how to use fseek and ftell to determine the size of a file.
FILE *fp; long file_size; char *buffer; fp = fopen(\"foo.bin\", \"r\
The reason to not use fstat is that fstat is POSIX, but fopen, ftell and fseek are part of the C Standard.
fstat
fopen
ftell
fseek
There may be a system that implements the C Standard but not POSIX. On such a system fstat would not work at all.