Go to the first, previous, next, last section, table of contents.


DTTOIF

Syntax

#include <dirent.h>

struct dirent *de;
mode_t file_mode = DTTOIF(de->d_type)

Description

This macro converts the d_type member of a struct dirent variable, as returned by readdir (see section readdir) to an equivalent value of the st_mode member of a struct stat variable (see section stat).

Note that the access rights are not set in the result returned by this macro. Only the file-type information is copied.

Return Value

The file's mode bits are returned. If the argument has the value DT_UNKNOWN, the result will be S_IFREG.

Portability

not ANSI, not POSIX (see note 1)

Notes:

  1. This macro is available on systems which support the d_type member in struct dirent.


Go to the first, previous, next, last section, table of contents.