Also used to return the string associated with a string stream.
The following table illustrates the predefined logical system streams with the name, mode, and initial physical stream number that they are initially assigned to.
Logical Name Mode Number input user read 0 output user write 1 error error write 2 toplevel_input user read 0 toplevel_output user write 1 answer_output user write 1 debug_input debug_input read 3 debug_output user write 1 null null update 4There are four other predefined logical streams:
Logical Name Mode Number stdin user read 0 stdout user write 1 stderr error write 2 user user read 0 user user write 1The first three of these are UNIX standard streams. The last stream user provides compatibility with other Prolog systems. When using user, it should be possible to decide if an input or output stream was meant.
Each of the above input streams has its own prompt which is printed on the specified output stream whenever new input is required. See set_prompt/3 for details on how to change this prompt.
Also see set_stream/2 for details on how to assign a logical stream to a physical stream.
Success: current_stream(Name,Mode,Stream). % returns all % open streams. [eclipse]: current_stream(error,Mode,Stream). Mode = write Stream = 2 More? (;) yes. [eclipse]: open(file,update,s), current_stream(file,M,s). M = update yes. [eclipse]: open(F,string(10),f), writeln(f, "bigstring"), > current_stream(Data,M,f). F = "bigstring\n" Data = "bigstring\n" M = string yes. Fail: open(file,update,f), current_stream("file",M,f). current_stream(X,no,Y). Error: current_stream(12,Mode,String). (Error 5).