CL_DirectoryScanner - ClanLib Game SDK

Home | All Classes | Grouped Classes | Index | Search

# Class CL_DirectoryScanner

Directory scanning class. More...

Derived from: none
Derived by: none
Group: Core (I/O Data)

#include <ClanLib/core.h>

Construction:

CL_DirectoryScanner | Constructs directory scanner for iterating over a directory.

Attributes:

get_directory_path | Gets the directory being scanned.
get_name | Gets the name of the current file.
get_size | Gets the size of the current file.
get_pathname | Gets the pathname of the current file.
is_directory | Returns true if the current file is a directory.
is_hidden | Returns true if the file is hidden.
is_readable | Returns true if the file is readable by the current user.
is_writable | Returns true if the file is writable by the current user.

Operations:

scan | Selects the directory to scan through.
next | Find next file in directory scan.

Detailed description:

!group=Core/IO Data! !header=core.h!

CL_DirectoryScanner is used to parse through directory trees and return information about files.

Example that prints all files and directories found in the root directory:

      CL_DirectoryScanner scanner;
      if (scanner.scan("/", "*"))
      {
      		while (scanner.next())
      		{
      				std::cout << scanner.get_name() << std::endl;
      		}
      }

Questions or comments, write to the ClanLib mailing list.