保存 Prolog 执行的输出
我正在 Prolog 中运行一个工具,执行后,结果将显示在 Prolog shell 内的屏幕上。如何将此结果复制到另一个文件中?
I am running a tool in Prolog, and after I execute it, the result will appear on the screen, inside the Prolog shell. How can I copy this result into another file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你从来没有说过你正在使用什么 prolog 解释器。
此代码适用于爱丁堡兼容版本的 Prolog,
就我而言,SWI-Prolog(在 Fedora 上)。
如果你有一个文件 hello.pl:
然后
退出解释器并在 shell 中:
完成后它不会返回到 shell,所以你需要找到一种方法来检查你的程序是否完成执行,然后 Ctrl-d 和检查你的输出文件
希望这有帮助
you never said what prolog interpreter you're using.
This code works for Edinburgh-compatible version of Prolog,
SWI-Prolog (on Fedora) in my case.
if you have a file hello.pl:
then
quit interpreter and in the shell:
it doesn't return to shell when it's done, so you need to find a way to check whether or not your program finished execution and then Ctrl-d and check your output_file
hope this helps
从命令行您可以执行以下操作:
From the command line you can do this: