telling/1

Synopsis

telling(-FileOrStream)

Unifies FileOrStream with the current output stream.

Arguments


FileOrStream file_spec or stream_object

Description

Exactly the same as current_output(FileOrStream) ref-iou-sfh-cos), except that FileOrStream will be unified with a filename if the current output stream was opened by tell/1.

If FileOrStream is not a filename or stream object corresponding to an open output stream, telling(FileOrStream) simply fails.

A common usage of telling/1 is

     tell('Some File Name')
     ...
     telling('Some File Name')
     

Should succeed if the current input stream was not changed (or if changed, restored). It succeeds for any filename (including user) and any stream object opened by open/3 (ref-iou-sfh-opn), but fails for user_output and any stream object opened by tell/1 (ref-iou-sfh-opn). Passing file names to tell/1 is the only DEC-10 Prolog usage of telling/1, so Quintus Prolog is compatible with this usage.

Examples

WARNING: The following sequence will fail if the current output stream was opened by tell/1.

     telling(File),
     ...
     set_output(File),
     

The only sequences that are guaranteed to succeed are

     telling(FileOrStream),
     ...
     tell(FileOrStream)
     

and

     current_output(Stream),
     ...
     set_output(Stream)
     

See Also

tell/1, open/[3,4], current_output/1