In this blog we are going to learn How to get file size using stat() system call in C/C++.  Stat system call under Linux displays file or file system status. We require to include sys/stat.h header to use stat() system call. Let us see simple example of using stat system call  in c/c++ program.

Example of How to get file size using stat() system call in C/C++

Some More about stat() system call

  The stat system calls return a stat structure, which contains the following fields:

Sample code for stat system call to get file mode and last access time

 

Ref:

https://en.wikipedia.org/wiki/Stat_(system_call)




Related Contents to follow