| cvs.gedasymbols.org/djgpp/doc/libc/libc_646.html | search | 
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
#include <dirent.h> struct dirent *readdir(DIR *dir);  | 
This function reads entries from a directory opened by opendir
(see section opendir).  It returns the information in a static buffer with
this format:
struct dirent {
  unsigned short d_namlen;  /* The length of the name (like strlen) */
  char d_name[MAXNAMLEN+1]; /* The name */
  mode_t d_type;            /* The file's type */
};
 | 
Note that some directory entries might be skipped by readdir,
depending on the bits set in the global variable
__opendir_flags.  See section opendir.
The possible values of the d_type member are:
DT_REG
DT_BLK
DT_CHR
DT_DIR
DT_FIFO
DT_LABEL
DT_LNK
DT_SOCK
DT_UNKNOWN
d_type
member if the exact file's type is too expensive to compute.  If the
__OPENDIR_NO_D_TYPE flag is set in the global variable
__opendir_flags, all files get marked with
DT_UNKNOWN.
The macro DTTOIF (see section DTTOIF) can be used to convert the
d_type member to the equivalent value of the st_mode
member of struct stat, see stat.
A pointer to a static buffer that is overwritten with each call.
| ANSI/ISO C | No | 
| POSIX | 1003.2-1992; 1003.1-2001 (see note 1) | 
Notes:
__opendir_flags variable is DJGPP-specific.  The d_type member is an extension available on some systems such as GNU/Linux.
DIR *d = opendir(".");
struct dirent *de;
while (de = readdir(d))
  puts(de->d_name);
closedir(d);
 | 
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
| webmaster | delorie software privacy | 
| Copyright © 2004 | Updated Apr 2004 |