Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catch existence_error

Status
Not open for further replies.

gianvix

Programmer
Jul 3, 2010
1
IT
Hi all,
how can I catch an existence_error ?

I'm just trying to open a file stream and handle the possibility that the file doesn't exists.
So when I do open( ... ) and the file doesn't exists, it just throws a existance_error.

I tried with the catch/3 predicate...but I don't know what to write on the 2th argument...I tried with a user defined exception and it worked..but I don't know how to handle the existence_error.. (tried with existence_error(X,Y) and it doesn't work).

Any idea?
Thank you
 
This is not an answer but in SWI-Prolog you have exists_file(+File)
Code:
exists_file(+File)
True if File exists  and is a regular file.  
This does not imply the user has read and/or write permission for the file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top