Seth Woolley's Man Viewer

Manual for readdir - man 3 readdir

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

READDIR(3)                 Linux Programmer's Manual                READDIR(3)



NAME
       readdir(2,3) - read(2,n,1 builtins) a directory

SYNOPSIS
       #include <sys/types.h>

       #include <dirent.h>

       struct dirent *readdir(2,3)(DIR *dir);

DESCRIPTION
       The  readdir(2,3)()  function returns a pointer to a dirent structure repre-
       senting the next directory entry in(1,8) the directory stream pointed to  by
       dir.   It  returns  NULL  on  reaching  the  end-of-file or if(3,n) an error(8,n)
       occurred.

       According to POSIX, the dirent structure contains a field char d_name[]
       of  unspecified  size,  with  at most NAME_MAX characters preceding the
       terminating null character.  Use of other fields will harm  the  porta-
       bility  of  your  programs.  POSIX 1003.1-2001 also documents the field
       ino_t d_ino as an XSI extension.

       The data returned by readdir(2,3)() may be overwritten by  subsequent  calls
       to readdir(2,3)() for the same directory stream.

RETURN VALUE
       The readdir(2,3)() function returns a pointer to a dirent structure, or NULL
       if(3,n) an error(8,n) occurs or end-of-file is reached.

ERRORS
       EBADF  Invalid directory stream descriptor dir.

CONFORMING TO
       SVID 3, BSD 4.3, POSIX 1003.1-2001

SEE ALSO
       read(2,n,1 builtins)(2), closedir(3), dirfd(3), opendir(3),  rewinddir(3),  scandir(3),
       seekdir(3), telldir(3)



                                  1996-04-22                        READDIR(3)

References for this manual (incoming links)