Stat Functions
The C POSIX library header stat
functions, as well as related function called fstat
and lstat
. The functions take a struct stat buffer argument, which is used to return the file attributes. On success, the functions return zero, and on error, −1 is returned and errno is set appropriately.
The stat and lstat functions take a filename argument. If the file name is a symbolic link, stat returns attributes of the eventual target of the link, while lstat returns attributes of the link itself. The fstat function takes a file descriptor argument instead, and returns attributes of the file that it identifies.
The family of functions was extended to implement large file support. Functions named stat64, lstat64 and fstat64 return attributes in a struct stat64 structure, which represents file sizes with a 64-bit type, allowing the functions to work on files 2 GiB and larger. When the _FILE_OFFSET_BITS macro is defined to 64, these 64-bit functions are available under the original names.
The functions are defined as:
int stat(const char *filename, struct stat *buf); int lstat(const char *filename, struct stat *buf); int fstat(int filedesc, struct stat *buf);Read more about this topic: Stat (system Call)
Famous quotes containing the word functions:
“Those things which now most engage the attention of men, as politics and the daily routine, are, it is true, vital functions of human society, but should be unconsciously performed, like the corresponding functions of the physical body.”
—Henry David Thoreau (18171862)