Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Dirent Class Reference

Define a portable C++ directory-entry iterator based on the POSIX API. More...

`#include <Dirent.h>`

List of all members.

## Public Methods
| ACE_Dirent (void)
| Default constructor. More...
ACE_EXPLICIT | ACE_Dirent (const ACE_TCHAR *dirname)
| Constructor calls <opendir>. More...
int | open (const ACE_TCHAR *filename)
| Opens the directory named by filename and associates a directory stream with it. More...
| ~ACE_Dirent (void)
| Destructor calls <closedir>. More...
void | close (void)
| Closes the directory stream and frees the <ACE_DIR> structure. More...
dirent * | read (void)
| Returns a pointer to a structure representing the directory entry at the current position in the directory stream to which dirp refers, and positions the directory stream at the next entry, except on read-only filesystems. More...
int | read (struct dirent *entry, struct dirent **result)
| Has the equivalent functionality as <readdir> except that an <entry> and <result> buffer must be supplied by the caller to store the result. More...
long | tell (void)
| Returns the current location associated with the directory stream. More...
void | seek (long loc)
| Sets the position of the next <readdir> operation on the directory stream. More...
void | rewind (void)
| Resets the position of the directory stream to the beginning of the directory. More...
## Private Attributes
ACE_DIR * | dirp_
| Pointer to the directory stream. More...

## Detailed Description

Define a portable C++ directory-entry iterator based on the POSIX API.

## Constructor & Destructor Documentation

ACE_INLINE ACE_Dirent::ACE_Dirent | ( | void |  | ) |

| Default constructor.

ACE_INLINE ACE_Dirent::ACE_Dirent | ( | const ACE_TCHAR * | dirname | ) |

| Constructor calls <opendir>.

ACE_INLINE ACE_Dirent::~ACE_Dirent | ( | void |  | ) |

| Destructor calls <closedir>.

## Member Function Documentation

ACE_INLINE void ACE_Dirent::close | ( | void |  | ) |

| Closes the directory stream and frees the <ACE_DIR> structure.

ACE_INLINE int ACE_Dirent::open | ( | const ACE_TCHAR * | dirname | ) |

| Opens the directory named by filename and associates a directory stream with it.

ACE_INLINE int ACE_Dirent::read | ( | struct dirent * | entry,
|  | struct dirent ** | result
| ) |

| Has the equivalent functionality as <readdir> except that an <entry> and <result> buffer must be supplied by the caller to store the result.

ACE_INLINE dirent * ACE_Dirent::read | ( | void |  | ) |

| Returns a pointer to a structure representing the directory entry at the current position in the directory stream to which dirp refers, and positions the directory stream at the next entry, except on read-only filesystems. It returns a NULL pointer upon reaching the end of the directory stream, or upon detecting an invalid location in the directory. <readdir> shall not return directory entries containing empty names. It is unspecified whether entries are returned for dot or dot-dot. The pointer returned by <readdir> points to data that may be overwritten by another call to <readdir> on the same directory stream. This data shall not be overwritten by another call to <readdir> on a different directory stream. <readdir> may buffer several directory entries per actual read operation; <readdir> marks for update the st_atime field of the directory each time the directory is actually read.

ACE_INLINE void ACE_Dirent::rewind | ( | void |  | ) |

| Resets the position of the directory stream to the beginning of the directory. It also causes the directory stream to refer to the current state of the corresponding directory, as a call to <opendir> would.

ACE_INLINE void ACE_Dirent::seek | ( | long | loc | ) |

| Sets the position of the next <readdir> operation on the directory stream. The new position reverts to the position associated with the directory stream at the time the <telldir> operation that provides loc was performed. Values returned by <telldir> are good only for the lifetime of the <ACE_DIR> pointer from which they are derived. If the directory is closed and then reopened, the <telldir> value may be invalidated due to undetected directory compaction. It is safe to use a previous <telldir> value immediately after a call to <opendir> and before any calls to readdir.

ACE_INLINE long ACE_Dirent::tell | ( | void |  | ) |

| Returns the current location associated with the directory stream.

## Member Data Documentation

ACE_DIR* ACE_Dirent::dirp_`[private]`

| Pointer to the directory stream.

The documentation for this class was generated from the following files:

- Dirent.h
- Dirent.i