next up previous contents
Next: Clever parameter handling (param_handler) Up: Simple Data Types and Previous: Error Handling (error)

   
Files and Directories (file)

The following functions are declared in <LEDA/file.h>.

string set_directory(string new_dir)
    sets the current working directory to new_dir and returns the name of the old cwd.
string get_directory() returns the name of the current working directory.
list<string> get_directories(string dir)
    returns the list of names of all sub-directories in directory dir.
list<string> get_files(string dir) returns the list of names of all regular files in directory dir.
list<string> get_files(string dir, string pattern)
    returns the list of names of all regular files in directory dir matching pattern.
list<string> get_entries(string dir) returns the list of all entries (directory and files) of directory dir.
bool is_directory(string fname)
    returns true if fname is the path name of a directory and false otherwise.
bool is_file(string fname) returns true if fname is the path name of a regular file and false otherwise.
bool is_link(string fname) returns true if fname is the path name of a symbolic link and false otherwise.
string tmp_file_name() returns a unique name for a temporary file.
bool delete_file(string fname) deletes file fname returns true on success and false otherwise.


next up previous contents
Next: Clever parameter handling (param_handler) Up: Simple Data Types and Previous: Error Handling (error)
LEDA research project
1998-10-02