system(File.dirname(FILE)+"/file.pl")
if i use this command the file.pl not run it, but if i use this command on Windows promt, it run.
Asked
Active
Viewed 226 times
-3
-
For a clear answer, please elaborate and give some context on your question. Did you received any errors? What did you run the command on the first case you mention? – Bert H Nov 07 '17 at 14:43
-
Welcome to SO. While we all like sharing a story from time to time, SO is not the place for that. Please use the edit button to rephrase your question into a question – Neuron Nov 07 '17 at 14:49
1 Answers
0
You need to specify path to Swi-Prolog executable first, and then specify file name to execute using -s parameter, for example:
system "C:/Program Files/swipl/bin/swipl-win.exe", "-s", File.dirname(FILE)+"/file.pl"
If you want Swi-Prolog to run particular goal after it is started, you can also add -g goal parameter:
system ".../swipl-win.exe", "-s", "yourfile.pl", "-g", "your_goal"
You can also make Swi-Prolog to exit after it has executed your goal by adding -t halt:
system ".../swipl-win.exe", "-s","yourfile.pl", "-g", "your_goal", "-t", "halt"

code_x386
- 778
- 3
- 5