0

Is there some way in prolog (SWI-Prolog) that I can get the name of the executing script just like the FILE in perl or arg[0] in C ?

I read the docs and I see nothing about this.. the docs actually dont give much support with anything and have very few examples :/

thanks for any help.

ace007
  • 577
  • 1
  • 10
  • 20
  • See the comments to the previous question with the swi-prolog tag. –  Mar 30 '13 at 18:02
  • @Boris it didn't help much :/ still cant figure out how to do it – ace007 Mar 30 '13 at 18:38
  • `current_prolog_flag(argv, Argv)` will give you the command line arguments used to invoke Prolog http://www.swi-prolog.org/pldoc/doc_for?object=current_prolog_flag/2 –  Mar 30 '13 at 19:37
  • @Boris: seems that your comment could be the answer. – CapelliC Mar 30 '13 at 21:21
  • @Boris but then how is it printed? I'm just getting error messages.. – ace007 Mar 31 '13 at 00:57
  • Comment on my answer; show what you are doing and your error messages. Google. –  Mar 31 '13 at 07:24

1 Answers1

0

current_prolog_flag(argv, Argv) will give you the command line arguments used to invoke Prolog, http://www.swi-prolog.org/pldoc/doc_for?object=current_prolog_flag/2