C Program to Check File Size – fseek/ftell and stat()

There are two standard ways to check file size in C: the portable fseek()/ftell() method that works with any FILE pointer, and the POSIX stat() method that reads file metadata without opening the file. This page covers both, with complete working programs, a comparison table, and when to use each. Method 1 — fseek() and …