《朱老师物联网大讲堂》学习笔记
学习地址:www.zhulaoshi.org
文件类型判断,
struct stat中的mode_t元素中,是一个按位来定义的,类似cpsr,
查看的话,需要按位&来操作,
不过linux给我们提供了很多宏来进行相应的操作,
The following POSIX macros are defined to check the file type using the
st_mode field:
S_ISREG(m) is it a regular file?
S_ISDIR(m) directory?
S_ISCHR(m) character device?
S_ISBLK(m) block device?
S_ISFIFO(m) FIFO (named pipe)?