struct stat

struct stat is a system struct that is defined to store information about files. It is used in several system calls, including fstat, lstat, and stat.


The struct stat is simply a structure with the following fields:

Field Name Description
st_mode The current permissions on the file.
st_ino The inode for the file (note that this number is unique to all files and directories on a Linux System.
st_dev The device that the file currently resides on.
st_uid The User ID for the file.
st_gid The Group ID for the file.
st_atime The most recent time that the file was accessed.
st_ctime The most recent time that the file's permissions were changed.
st_mtime The most recent time that the file's contents were modified.
st_nlink The number of links that there are to this file.

Code Snippet

The struct stat by itself is useless, but for examples of its use, see the fstat snippet or the stat snippet.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License