www.delorie.com/djgpp/doc/libc-2.01/libc_526.html   search  
Go to the first, previous, next, last section, table of contents.


readdir

Syntax

#include <dirent.h>

struct dirent *readdir(DIR *dir);

Description

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 */
};

Return Value

A pointer to a static buffer that is overridden with each call.

Example

DIR *d = opendir(".");
struct dirent *de;
while (de = readdir(d))
  puts(de->d_name);
closedir(d);


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

  prev next   webmaster     delorie software   privacy  
  Copyright © 1997     Updated Apr 1997