Prolog - Finding the current directory, relative directory for 'tell' predicate

Posted by Bharat on Stack Overflow See other posts from Stack Overflow or by Bharat
Published on 2010-04-14T12:31:40Z Indexed on 2010/04/14 12:33 UTC
Read the original article Hit count: 242

Filed under:
|
|

I'm having trouble trying to figure out how to get prolog to spit out a text file where I want it to. I'm currently doing a bunch of operations and then using

tell('output.txt')

to record the output. Now the problem is that when I do this, it creates this file in the SWI \bin\ folder. I was wondering if there's a way to make it create this file in the directory containing the actual .pl file. So even if the file was moved (and it will be), the text file gets created right where the source file is.

Long story short, is there a way to get the location of the source file once the source file has been consulted?

Many Thanks!

© Stack Overflow or respective owner

Related posts about prolog

Related posts about swi-prolog