【发布时间】:2013-04-30 13:30:45
【问题描述】:
我想通过命令提示符运行 swipl prolog,我想将 input.txt 作为查询文件读取并希望将结果输出到 output.txt
我的命令行命令:
swipl -f asd.pl < input.txt > output.txt
但是我的输出结果是在命令提示符下出现并得到空白的 output.txt 文件。
【问题讨论】:
我想通过命令提示符运行 swipl prolog,我想将 input.txt 作为查询文件读取并希望将结果输出到 output.txt
我的命令行命令:
swipl -f asd.pl < input.txt > output.txt
但是我的输出结果是在命令提示符下出现并得到空白的 output.txt 文件。
【问题讨论】:
它适合我。您确定在命令提示符下没有收到错误吗?
注意:要输出 stderr 你应该使用2> filename
示例(test.pl):
:- initialization(main).
main:-
repeat,
read(Term),
writeln(term(Term)),
Term=end_of_file -> halt, fail.
swipl.exe -f test.pl < test.pl > test.txt 2> stderr.txt
写在 test.txt:
term((:-initialization main))
term((main:-repeat,read(_G747),writeln(term(_G747)),_G747=end_of_file->halt,fail))
term(end_of_file)
在 stderr.txt 上:
% c:/swi/workspace/test.pl compiled 0.00 sec, 4 clauses
【讨论】:
-q 修饰符:swipl.exe -q -f test.pl < test.pl > test.txt 2> stderr.txt