From 7e0f021a9aec35fd8e6725e87e3313b101d26f5e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 27 Jan 2008 11:37:44 +0100 Subject: Initial import (2.0.2-6) --- reference/C/FUNCTIONS/directory.html | 134 +++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 reference/C/FUNCTIONS/directory.html (limited to 'reference/C/FUNCTIONS/directory.html') diff --git a/reference/C/FUNCTIONS/directory.html b/reference/C/FUNCTIONS/directory.html new file mode 100644 index 0000000..2e426f0 --- /dev/null +++ b/reference/C/FUNCTIONS/directory.html @@ -0,0 +1,134 @@ +Directory functions. + + + + +
+
+

Directory functions

+
+
+

+ +OK. First things first. These functions are NOT part of the ANSI standard +library. They may not be supported on your platform. +

+ +Here is a quick summary of each function, they are listed in the order in +which you may want to execute them. + +

  • opendir Open a directory stream. +
  • readdir read the current entry in the stream. +
  • scandir Find an entry in a direcory. +
  • seekdir Jump to a directory offset. +
  • telldir Return the current location within the directory stream. +
  • rewinddir Return to the start of the directory stream. +
  • closedir Close a directory. + + +
    + + + + + +
    +
    +
    +  Library:   dirent.h
    +
    +  Prototype: DIR *opendir(const char *name);
    +
    +             struct dirent *readdir(DIR *dir);
    +
    +             int scandir(const char *dir, struct dirent ***namelist,  
    +                 int (*select)(const struct dirent *),
    +                 int (*compar)(const void *, const void *));
    +		
    +	     void seekdir(DIR *dir, off_t offset);
    +
    +	     off_t telldir(DIR *dir);
    +
    +	     void rewinddir(DIR *dir);
    +
    +	     int closedir(DIR *dir);
    +
    +
    + +The dirent structure does not seem to be documented in the man pages, +so here it is. +

    + + + + +
    +
    +
    +	struct dirent 
    +	{
    +          long            d_ino;
    +       	  off_t           d_off;
    +       	  unsigned short  d_reclen;
    +       	  char            d_name[NAME_MAX+1];
    +	};
    +
    +
    + + + example program using opendir, readdir and closedir. +

    +


    +

    See Also:

    + +stat function. +

    +


    +

    man Pages:

    + +opendir + +readdir + +scandir + +seekdir + +telldir + +rewinddir + +closedir + + +

    + +


    +

    +

    + + + + +
    + Top + + Master Index + + Keywords + + Functions +
    +
    +

    +


    +
    Martin Leslie +

    + + + + + + + -- cgit v1.2.3-54-g00ecf