Merge pull request #1100 from aarroyoc/phrase-to-file-options

Add phrase_to_file/3 (phrase_to_file with Options)
This commit is contained in:
Mark Thom
2021-11-21 15:27:17 -05:00
committed by GitHub

View File

@@ -12,6 +12,7 @@
:- module(pio, [phrase_from_file/2, :- module(pio, [phrase_from_file/2,
phrase_from_file/3, phrase_from_file/3,
phrase_to_file/2, phrase_to_file/2,
phrase_to_file/3,
phrase_to_stream/2 phrase_to_stream/2
]). ]).
@@ -109,6 +110,9 @@ phrase_to_stream(GRBody, Stream) :-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
phrase_to_file(GRBody, File) :- phrase_to_file(GRBody, File) :-
setup_call_cleanup(open(File, write, Stream), phrase_to_file(GRBody, File, []).
phrase_to_file(GRBody, File, Options) :-
setup_call_cleanup(open(File, write, Stream, Options),
phrase_to_stream(GRBody, Stream), phrase_to_stream(GRBody, Stream),
close(Stream)). close(Stream)).