next up previous contents index
Next: Some Useful Functions ( 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.
string first_file_in_path(string fname, string path, char sep = ':')
    searches all directories in string path (separated by sep) for the first directory dir that contains a file with name fname and returns dir/fname (the empty string if no such directory is contained in path).


next up previous contents index
Next: Some Useful Functions ( Up: Simple Data Types and Previous: Error Handling ( error
LEDA research project
1999-04-23