# include <sys/stat.h>

 
  • stat
    • int stat(const char *path, struct stat * buf); struct stat { dev_t st_dev; /*ID of device containing file */ ino_t st_ino; /*inode number*/ mode_t st_mode; /*protection*/ nlink_t st_nlink; /*number of hard links*/ uid_t st_uid; /*user ID of owner*/ gid_t st_gid; /*group ID of owner*/ dev_t st_rdev; /*device ID (if special file)*/ off_t st_size; /*total size, in byte*/ blksize_t st_blksize; /*blocksize for file system I/O*/ blkcnt_t st_blocks; /*number of 512B blocks allocated*/ time_t; st_atime; /*time of last access*/ time_t; st_mtime; /*time of last modification*/ time_t st_xtime; /*time of last status change*/ }; 원본의 정보 구조체에 채운다.
  • lstat
    • int lstat(const char *path, struct stat * buf); stat함수와 동일하게 작동하지만 path가 심볼릭 링크 파일인 경우, 심볼릭 링크 파일에 대한 정보를 구조체에 채운다.
  • fstat
    • int fstat(int fd, struct stat * buf); stat 함수와 같은데 파일디스크립터를 통해 사용하는 함수이다.