C program to find the size of a file in Linux
In this program we will get the size of the file using two methods:
- Using stat() function - Compatible for GCC, G++ Compilers
- Using fseek() and ftell() functions – Compatible for GCC, G++ and TURBOC Compilers
In the program, firstly we will create a file and in which we will write some characters (here A to Z characters has written, where total size of the file will be 26 bytes.).
File Size using C program in Linux and Windows
Get file size using stat() function
Output:
Get file size using fseek() and ftell() function
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer