Finding Out About Open Streams

current_stream(File, Mode, Stream) succeeds if Stream is a stream that is currently open on file File in mode Mode, where Mode is either read, write, or append. None of the arguments need be initially instantiated. This predicate is nondeterminate and can be used to backtrack through all open streams. current_stream/3 ignores certain pre-defined streams, including the initial values of the special streams for the standard input, output, and error channels.

stream_property(Stream, Property) succeeds if Stream is a currently open stream with property Property. Pre-defined streams, like the three standard channels, are not ignored.

Send feedback on this subject.