S_ISDIR()函数

功能是判断一个路径是否为目录

在sys/stat.h中还定义了更多相关的函数

The following symbolic names for the values of type mode_t shall also be defined.

File type:

S_IFMT
Type of file.
S_IFBLK
Block special.
S_IFCHR
Character special.
S_IFIFO
FIFO special.
S_IFREG
Regular.
S_IFDIR
Directory.
S_IFLNK
Symbolic link.
S_IFSOCK
Socket. 
File mode bits:

S_IRWXU
Read, write, execute/search by owner.
S_IRUSR
Read permission, owner.
S_IWUSR
Write permission, owner.
S_IXUSR
Execute/search permission, owner.
S_IRWXG
Read, write, execute/search by group.
S_IRGRP
Read permission, group.
S_IWGRP
Write permission, group.
S_IXGRP
Execute/search permission, group.
S_IRWXO
Read, write, execute/search by others.
S_IROTH
Read permission, others.
S_IWOTH
Write permission, others.
S_IXOTH
Execute/search permission, others.
S_ISUID
Set-user-ID on execution.
S_ISGID
Set-group-ID on execution.
S_ISVTX
[XSI]  On directories, restricted deletion flag. 
The bits defined by S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH, S_ISUID, S_ISGID, [XSI]   and S_ISVTX   shall be unique.

S_IRWXU is the bitwise-inclusive OR of S_IRUSR, S_IWUSR, and S_IXUSR.

S_IRWXG is the bitwise-inclusive OR of S_IRGRP, S_IWGRP, and S_IXGRP.

S_IRWXO is the bitwise-inclusive OR of S_IROTH, S_IWOTH, and S_IXOTH.

Implementations may OR other implementation-defined bits into S_IRWXU, S_IRWXG, and S_IRWXO, but they shall not overlap any of the other bits defined in this volume of IEEE Std 1003.1-2001. The file permission bits are defined to be those corresponding to the bitwise-inclusive OR of S_IRWXU, S_IRWXG, and S_IRWXO.

The following macros shall be provided to test whether a file is of the specified type. The value m supplied to the macros is the value of st_mode from a stat structure. The macro shall evaluate to a non-zero value if the test is true; 0 if the test is false.

S_ISBLK(m)
Test for a block special file.
S_ISCHR(m)
Test for a character special file.
S_ISDIR(m)
Test for a directory.
S_ISFIFO(m)
Test for a pipe or FIFO special file.
S_ISREG(m)
Test for a regular file.
S_ISLNK(m)
Test for a symbolic link.
S_ISSOCK(m)
Test for a socket.

S_ISDIR()函数相关推荐

  1. linux函数删除某文件,Linux环境下用C++删除指定文件

    Linux环境下用C++删除指定文件 "Talk is cheap, show me the code!" #include #include #include #include ...

  2. Linux C编程一些函数汇总

    之前项目用到的函数汇总一下: 1.access 原型:int access(const char *filenpath, int mode); 头文件:io.h 功 能: 确定文件或文件夹的访问权限. ...

  3. 计算机科学精彩帖子收集

    linux源码 LXR 源自"the Linux Cross Referencer",中间的"X"形象地代表了"Cross".与 Sourc ...

  4. linux 内核 proc_create 函数 内幕初探

    一直以为PROC文件系统很是晦涩难懂,平时仅仅是使用它,不愿意去触碰内核中的具体实现.今天突发奇想,想看看里面究竟是怎么实现的,结果--真是大跌眼镜,没想到里面并不复杂 关于PROC文件系统的功能以及 ...

  5. linux c glob使用(文件路径模式查找函数)

    glob库函数用于Linux文件系统中路径名称的模式匹配,即查找文件系统中指定模式的路径.注意,这不是正则表达式匹配,虽然有些相似,但还是有点差别. glob函数原型        #include ...

  6. linux stat函数讲解

    stat函数讲解 表头文件:    #include <sys/stat.h>              #include <unistd.h> 定义函数:    int st ...

  7. 《APUE》中的函数整理

    第1章 unix基础知识 1. char *strerror(int errnum) 该函数将errnum(就是errno值)映射为一个出错信息字符串,返回该字符串指针.声明在string.h文件中. ...

  8. linux glob函数详解

    glob库函数用于Linux文件系统中路径名称的模式匹配,即查找文件系统中指定模式的路径.注意,这不是正则表达式匹配,虽然有些相似,但还是有点差别. glob函数原型        #include ...

  9. Linux学习:文件属性函数

    1.stat 命令 stat filename ,功能上类似于 ls - l. 2.stat 函数 (1)头文件: #include <sys/types.h>#include <s ...

最新文章

  1. ERP与GMP结合在药类企业实施及应用
  2. CTF——angr使用学习记录
  3. laravel 控制器 中间件 传递数据_Laravel5 自定义路由中间件的使用步骤,太好用,珍藏了!...
  4. 用getBoundingClientRect()来获取页面元素的位置
  5. 80--查询分组关联属性
  6. Windows端口占用情况?
  7. linux_安装jdk和mysql简单步骤记
  8. 使用电脑adb给Essential Phone刷机 —(官方篇)
  9. kt条件例题运筹学_2016年山东大学管理学院运筹学(线性规划部分)之运筹学基础及应用(同等学力加试)复试笔试最后押题五套卷...
  10. C++:标准程序库-STL迭代器Iterator
  11. Atitit Cookie安全法 目录 1. cookie分为 会话cookie 和 持久cookie , 1 1.1. 安全措施 1 1.2. 3. cookie的同源策略 2 1.3. 安全类库
  12. Nvivo的使用学习
  13. 新东方王江涛十天背单词法(艾宾浩斯记忆曲线)(适用于各阶段各种记忆背诵类的知识点,许多人成功上岸)
  14. Wincc语音报警 Wincc真人声音报警
  15. win10很多软件显示模糊_Win7系统和Win10系统你会怎么选?
  16. html中的==$0是什么意思
  17. oracle数据库12cocp培训教程,OCA/OCP认证考试指南全册(第3版) Oracle Database 12c 中文pdf扫描版[164MB]...
  18. OrCAD 与 Cadence Allegro PCB 入门 - 以 16.6版本为例 (3)
  19. python 幂数拟合及拟合度计算
  20. Flink系列之Flink集群搭建

热门文章

  1. ES6 try catch 使用方法
  2. [The Preliminary Contest for ICPC Asia Xuzhou 2019 - 徐州网络赛E] XKC's basketball team
  3. strtoul和errno的合作
  4. strict_strtoul函数找不到定义问题
  5. 怎么用PHP判定奇偶性,怎么判断函数的奇偶性
  6. 某个音乐网站的音乐地址寻找方式
  7. 感受 Surprising - Astonishing - Shocking 的区别
  8. matlab编写正整数阶乘函数,用matlab语言编写程序:编写一个计算阶乘的函数,再编写一个脚本文件,通过键盘输入计算阶乘的n值....
  9. GMesh网格选项介绍
  10. 计算机系统英语参考文献短,英文计算机类论文参考文献 英文计算机论文参考文献哪里找...