文件与目录操作函数

来源:互联网 发布:鬼泣4特别版n卡优化 编辑:程序博客网 时间:2024/05/18 00:36

lstat. stat, fstat

int stat(const char *pathname, struct stat *buf);

int fstat(int fields, struct stat *buf);

int lstat(const char *pathname, struct stat *buf);

 

给定一个 pathname, stat函数返回一个与此命名文件有关的信息结构。

 

S_ISREG( )   普通文件

S_ISDIR( )    目录文件
S_ISCHR( )   字符特殊文件  
S_ISBLK( )    块特殊文件

S_ISFIFO( )   管道或FIFO

S_ISLNK( )     符号连接

S-ISSOCK( )    套接字

 

 

int access(const char *pathname, int mode)

按实际用户ID和实际组ID来进行存取许可权测试

 

 

 

chmod, fchmod

fchmod, 对已打开的文件权限进行修改

 

 目录操作

readdir

rewinddir

closedir

 

 

chdir

fchdir

getcwd   获得当前工作目录的绝对路径名

 

 

 

 

原创粉丝点击