#include <sys/dirent.h>
sys/dirent.h
structdirent
| __uint64_t | d_ino | file number of entry |
| __uint64_t | d_seekoff | seek offset (optional, used by servers) |
| __uint16_t | d_reclen | length of this record |
| __uint16_t | d_namlen | length of string in d_name |
| __uint8_t | d_type | file type, see below |
| char[1024] | d_name | entry name (up to MAXPATHLEN bytes) |
macroMAXNAMLEN
#define MAXNAMLEN __DARWIN_MAXNAMLEN
macroDT_FIFO
#define DT_FIFO 1
macroDT_CHR
#define DT_CHR 2
macroDT_DIR
#define DT_DIR 4
macroDT_BLK
#define DT_BLK 6
macroDT_REG
#define DT_REG 8
macroDT_LNK
#define DT_LNK 10
macroDT_SOCK
#define DT_SOCK 12
macroDT_WHT
#define DT_WHT 14
macroIFTODT
Convert between stat structure types and directory types.
#define IFTODT(mode) (((mode) & 0170000) >> 12)
macroDTTOIF
#define DTTOIF(dirtype) ((dirtype) << 12)