![]() |
![]() |
Public Types | |
typedef DirIterator | iterator |
typedef DirIterator | const_iterator |
Public Member Functions | |
Dir (const std::string& path) | |
Opens a directory for reading. | |
~Dir () | |
Closes the directory and deallocates all related resources. | |
std::string | read_name () |
Retrieves the name of the next entry in the directory. | |
void | rewind () |
Resets the directory. | |
void | close () |
Closes the directory and deallocates all related resources. | |
DirIterator | begin () |
Get the begin of an input iterator sequence. | |
DirIterator | end () |
Get the end of an input iterator sequence. |
It's highly recommended to use the iterator interface. With iterators, reading an entire directory into a STL container is really easy:
|
|
|
|
|
Opens a directory for reading. The names of the files in the directory can then be retrieved using read_name().
|
|
Closes the directory and deallocates all related resources.
|
|
Get the begin of an input iterator sequence.
|
|
Closes the directory and deallocates all related resources. Note that close() is implicitely called by ~Dir(). Thus you don't need to call close() yourself unless you want to close the directory before the destructor runs. |
|
Get the end of an input iterator sequence.
|
|
Retrieves the name of the next entry in the directory.
The
|
|
Resets the directory. The next call to read_name() will return the first entry again. |