1. Stat struct
The structure is defined in the/usr/include/sys/STAT. h file.
Struct stat finfo;
Stat (sfilename, & finfo );
Int size = finfo. st_size;
Struct stat {
Mode_t st_mode; // file mode, file, directory, etc.
Ino_t st_ino; // I-node number
Dev_t st_dev; // device number
Dev_t st_rdev; // special device number
Nlink_t st_nlink; // number of file connections
Uid_t st_uid; // file owner
Gid_t st_gid; // group corresponding to the file owner
Off_t st_size; // common file, corresponding to the number of bytes
Time_t st_atime; // time when the object was last accessed
Time_t st_mtime; // The last modification time of the file content
Time_t st_ctime; // File status (attribute) Change Time
Blksize_t st_blksize; // block size corresponding to the file content
Blkcnt_t st_blocks; // number of blocks corresponding to the file content
};
Stat Function: Get File Information:
Stat (file_route, & Stat); If the returned value is 0, the operation succeeds. Otherwise, the operation fails.