get_line/1/2 行を1行読み込みます。ファイルの終了時には失敗します。
result atom stream atom
main([Infile,Outfile|_]) :- open(Infile,read,Instream), open(Outfile,write,Outstream), copy(Instream,Outstream), close(Instream), close(Outstream).copy(Instream,Outstream) :- get_line(Instream,Line), write(Outstream,Line),nl(Outstream), copy(Instream,Outstream). copy(_Instream,Outstream) :- flush_output(Outstream).
この述語は、ISO-Prolog標準に含まれない。