I am trying to write an interface between the shell and swi-prolog so I would like (preferably) to have the text come in one line at a time but I can see why that might not possible. Swi-prolog has a shell predicate that will give the output of a shell command but I cannot figure out how to set that output to a variable. It would also work to have swipl take the output and print it again. Any ideas?
Asked
Active
Viewed 56 times
1 Answers
0
Your shell can write its result to a file. Then call your swi-prolog prog to read in the file contents to a string and reformat it to your liking. E.g. selecting parts of the output to be your value, using things like DCG.
Unless I understood your question wrongly, you want it the other way, prolog to shell.

peter.cyc
- 1,763
- 1
- 12
- 19