dirent
Dirent, short for directory entry, is a portable API used by POSIX-compliant systems to read the contents of a directory. It is defined in the dirent.h header and centers on two main concepts: the DIR type, which represents an open directory stream, and the struct dirent, which represents a single directory entry. The d_name field stores the entry name, and many implementations also provide d_ino (inode number) and d_type (the entry’s file type, such as DT_DIR or DT_REG). The exact fields and their availability can vary between platforms; some fields may be absent or require additional checks.
The standard operations are opendir, readdir, and closedir. opendir opens a directory stream and returns a DIR*;
Portability and caveats: the dirent interface is defined by POSIX and is widely implemented on Linux, BSD,
Example usage pattern: open a directory with opendir, iterate with readdir to process each entry by name,