#include <sys/stat> /* 头文件 */
int stat(const char *restrict pathname, struct stat *restrict buf);
int fstat(int fd, struct stat *buf);
int lstat(const char *restrict pathname, struct stat *restrict buf);
int fstatat(int fd, const char *restrict pathname, struct stat *restrict buf, int flag);
/* 函数成功返回0,失败返回-1; */
struct stat { /* stat结构体 */
mode_t st_mode; //文件对应的模式,文件,目录,权限等
ino_t st_ino; //i-node节点号
dev_t st_dev; //设备号码
dev_t st_rdev; //特殊设备号码
nlink_t st_nlink ; //文件的硬链接数
uid_t st_uid; //文件所有者
gid_t st_gid; //文件所有者对应的组
off_t st_size; //普通文件,对应的文件字节数
struct timespec st_atime; //文件最后被访问的时间
struct timespec st_mtime; //文件内容最后被修改的时间
struct timespec st_ctime; //文件状态(属性)改变时间
blksize_t st_blksize; //文件内容对应的块大小
blkcnt_t st_blocks; //文件内容对应的块数量
}
刚刚
猜你喜欢
转载自blog.csdn.net/isunbin/article/details/81146996
今日推荐
周排行