telling(?name)

This built-in predicate identifies the name of the current output stream. The name of the current output stream is unified with the value of the parameter Name. If the current output stream is connected to a file then the name of the file is returned, if the standard output stream is the current output stream then the value 'user' is unified with the Name parameter.

Arrow.gif (1632 bytes)To preverse compatibility with other Prolog systems not the name 'user_output' is returned, but 'user'. This predicate is not defined in the ISO Prolog standard.

see also: at_end_of_stream/0 at_end_of_stream/1 close/1 close/2 close_user_streams/0 current_output/1 flush_output/0 flush_output/1 open/3 open/4 prolog I/O set_input/1 set_output/1 set_stream_position/2 stream_property/2

Example
telling(Name). Name is unified with the term 'user', which is the name of the standard output stream
tell('c:\\temp\\test.txt'),
telling(Name),
told.
the file 'c:\\temp\\test.txt' is opened (or created) and made the current output stream then telling/1 is used to retrieve the name of the current output stream, the value of Name after telling/1 is 'c:\\temp\\test.txt',  the stream is then closed.

 

 

info@trinc-prolog.com