Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page   Data Structures   File List   Data Fields   Globals  

dirent.h File Reference


Detailed Description

Functions for directory listing.

This library contains functions that allow applications to list the contents of a directory. To use this library, the file system must also be installed and initialized.

Note that not all of the traditional dirent functions are implemented.

For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.

Warning:
Some functions in this library are NOT multi-process safe--that is, if you call the same method from two different processes at the same time, the parameters to the function may be destroyed, yielding unpredictable results. Consult each individual funtion's documentation for details on which functions are multi-process safe.

Go to the source code of this file.

Data Structures

struct  dirent

Defines

#define ROM400_DIRENT_VERSION   2

Typedefs

typedef unsigned char * DIR

Functions

int closedir (DIR *dir)
 Close a directory stream.

DIRopendir (const char *name)
 Open a directory stream.

direntreaddir (DIR *dir)
 Read a directory entry from a directory stream.

void rewinddir (DIR *dir)
 Resets the directory stream.

void seekdir (DIR *dir, long int ptr)
 Sets the directory stream location.

long int telldir (DIR *dir)
 Returns the current location in the directory stream.

unsigned int dirent_version (void)
 Returns the version number of this DIRENT library.


Define Documentation

#define ROM400_DIRENT_VERSION   2
 

Version number associated with this header file. Should be the same as the version number returned by the dirent_version function.

See also:
dirent_version


Typedef Documentation

typedef unsigned char* DIR
 

Type definition for a directory structure. This object must not be altered by the application during use. Make sure to call the closedir function when finished with any DIR object.


Function Documentation

int closedir DIR   dir
 

Close a directory stream.

Closes the directory stream dir, and frees the resources allocated to it.

Parameters:
dir Directory resource to free.
Returns:
0 on success, non-zero if the directory could not be closed.
See also:
opendir

unsigned int dirent_version void   
 

Returns the version number of this DIRENT library.

Returns:
Version number of this DIRENT library.

DIR* opendir const char *    name
 

Open a directory stream.

Opens a directory stream for the directory name. The argument name should not have leading or trailing slashes. To open the root directory, use the empty string (opendir("");).

Parameters:
name Name of the directory to open
Returns:
Pointer to a directory stream object, or NULL if the directory could not be found.
See also:
closedir

struct dirent* readdir DIR   dir
 

Read a directory entry from a directory stream.

Reads the current directory entry from the directory stream dir. This function also increments the internal stream counter, so the next call to readdir will read the next directory entry.

Before using the returned file name, call fexists to make sure the file still exists. It could have been deleted between the time the directory stream was opened and now, which would yield an invalid result.

Parameters:
dir Directory stream to read an entry from.
Returns:
Pointer to a directory entry, or NULL if the end of the directory stream has been reached.
See also:
rewinddir

seekdir

telldir

void rewinddir DIR   dir
 

Resets the directory stream.

Resets the directory stream to the beginning, so the first directory entry is read again.

Parameters:
dir Directory stream to be reset.
See also:
seekdir

telldir

void seekdir DIR   dir,
long int    ptr
 

Sets the directory stream location.

Sets the current 'pointer' into the directory stream to the value ptr. Internally, the directory stream is simply an array of file pointers. This function sets the current index into that array. If ptr is beyond the bounds of the array, the next call to readdir will return NULL;

Parameters:
dir Directory stream to set location
ptr Location to point to in stream
See also:
readdir

telldir

long int telldir DIR   dir
 

Returns the current location in the directory stream.

Returns the current location in the directory stream. Internally, the directory stream is simply an array of file pointers. This function returns the current index into that array.

Parameters:
dir Directory stream to get location
See also:
readdir

seekdir


Copyright 2004 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.