Go to the previous, next section.

Format of a Directory Entry

This section describes what you find in a single directory entry, as you might obtain it from a directory stream. All the symbols are declared in the header file `dirent.h'.

Data Type: struct dirent

This is a structure type used to return information about directory entries. It contains the following fields:

char *d_name
This is the null-terminated file name component. This is the only field you can count on in all POSIX systems.

ino_t d_fileno
This is the file serial number. For BSD compatibility, you can also refer to this member as d_ino.

size_t d_namlen
This is the length of the file name, not including the terminating null character.

This structure may contain additional members in the future.

When a file has multiple names, each name has its own directory entry. The only way you can tell that the directory entries belong to a single file is that they have the same value for the d_fileno field.

File attributes such as size, modification times, and the like are part of the file itself, not any particular directory entry. See section File Attributes.

Go to the previous, next section.