31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.12 Files and Directories ( file )<br />

<strong>The</strong> following functions are declared in .<br />

string<br />

set directory(string new dir)<br />

sets the current working directory to new dir and returns<br />

the name of the old cwd.<br />

string get directory( ) returns the name of the current working directory.<br />

string<br />

get home directory( ) returns the name of the user’s home directory.<br />

string get directory delimiter( )<br />

returns the character that delimits directory names in<br />

a path (i.e. “\” on Windows and “/” on Unix).<br />

void<br />

void<br />

list<br />

append directory delimiter(string& dir)<br />

appends the directory delimiter to dir if dir does not<br />

already end with the delimiter.<br />

remove trailing directory delimiter(string& dir)<br />

get directories(string dir)<br />

removes the directory delimiter from dir if dir ends<br />

with it.<br />

returns the list of names of all sub-directories in directory<br />

dir.<br />

list get files(string dir) returns the list of names of all regular files in directory<br />

dir.<br />

list<br />

list<br />

bool<br />

bool<br />

get files(string dir, string pattern)<br />

get entries(string dir)<br />

create directory(string fname)<br />

is directory(string fname)<br />

returns the list of names of all regular files in directory<br />

dir matching pattern.<br />

returns the list of all entries (directory and files) of<br />

directory dir.<br />

creates a directory with name dname, returns true on<br />

success.<br />

returns true if fname is the path name of a directory<br />

and false otherwise.<br />

bool is file(string fname) returns true if fname is the path name of a regular file<br />

and false otherwise.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!