:-mode read_data(++,-).
read_data(File,Result):-
open(File,read,S),
read(S,X),
read_data_lp(S,X,Result),
close(S).
read_data_lp(_S,end_of_file,[]):-
!.
read_data_lp(S,X,[X|R]):-
read(S,Y),
read_data_lp(S,Y,R).
This method is very easy to use if both source and sink of the data are ECLiPSe programs. Unfortunately, data provided by other applications will normally not be in the Prolog term format. For them we will have to use some other techniques6.1.