/*
	The atoms are read from the input file 
	and written in the output file
*/
copy(InputFile,OutputFile) :- 
	% Open the file for reading
	open(InputFile,read,InputStream),       

	% Open the file for writing
	open(OutputFile,write,OutputStream),       

	% Loop driving by failure 
    repeat, 
		read(InputStream, Atom),    % read the atom from input stream 
		process(OutputStream,Atom), % process the atom: write in the output stream

	 % Close the streams
	close(InputStream),
	close(OutputStream),
	!.

/* Atom of end of file */
process(_,end_of_file) :- !. 

/* Process the atom */
process(OutputStream,Atom) :-
		% Write the atom
		write(OutputStream,Atom), 
		% Write the dot
		put(OutputStream,46), 
		% New line
		nl(OutputStream), 
		% Loop driving by failure 
		fail. 
