【TLPI读书笔记】 十五、文件属性
获取文件信息:stat()
利用系统调用stat()
、lstat()
以及fstat
,可获取与文件有关的信息,其中大部分提取自文件i节点
#include <sys/stat.h>
int stat(const char *pathname, struct stat *statbuf);
int lstat(const char *pathname, struct stat *statbuf);
int fstat(int fd, struct stat *statbuf);
All return 0 on success, or -1 on error