stat,fstat,lstat小区别

来源:互联网 发布:手机淘宝网下载安装 编辑:程序博客网 时间:2024/04/30 03:28

#include<sys/stat.h>
#include<unistd.h>

 

fstat(int fd,&(struct stat)buf);

stat(const char* file_name,&(struct stat)buf);

lstat(const char* file_name,&(struct stat)buf);

 

lstat()与stat()作用完全相同,都是取得参数file_name所指的文件状态,其差别在于,当文件为符号连接时,lstat()会返回该link本身的状态

 

原创粉丝点击