program:- 
       display("File -> "),
		   read(String),
  		   % Convert the String into an Atom 
  		   name(Atom,String),		
		   % Open the File indicated by the Atom 
		   open(Atom,read,Stream),
		% Loop driving by failure 
       repeat,
		   get0(Stream,Character),
    	   process(Character),
       close(Stream),
       !.

% End of file = -1 
process(-1):- !.

% Process the rest of character 
process(Character):- put(Character), fail.

