/*
	The atoms are read from the file

	Version 4
		open, set_input
*/

browse:- 
	% The name of the file is asked to the user. 
    display("File with quotes-> "),
	read(String),

	% Convert the String into an Atom 
	name(File,String),		

	/* Save for later the current input  */ 
	current_input(Old),

	% Open for reading the file indicated by Atom 
	open(File,read,Stream),       

	% The stream is the new current input
	set_input(Stream),

	% Loop driving by failure 
    repeat, 
		read(Atom),     % read the atom from file 
		process(Atom),  % process the atom 

	 % Close the stream
	close(Stream),   

	set_input(Old),
	% Stop now 
    !.

/* Atom of end of file */
process(end_of_file) :- !. 

/* Process the atom */
process(Atom) :-
		/* Write atom */
		write(Atom), 
		nl, 
		/* Loop driving by failure */
		fail. 
