Possible Duplicate:
Read a file line by line in Prolog
I found the following prolog code which reads one character at a time and prints out.
process(File) :-
open('C:/Users/BHARAT/Desktop/a.txt', read, In),
get_char(In, Char1),
process_stream(Char1, In),
close(In).
process_stream(end_of_file, _) :- !.
process_stream(Char, In) :-
print(Char),
get_char(In, Char2),
process_stream(Char2, In).
But if the file has multiple lines is there a way to read 1 whole line at a time so that it will be easy for tokenizing.