Prolog program to read and write file.
domains file = xinput predicates start reading goal clearwindow, start. clauses start:- openread(xinput,"data.txt"), readdevice(xinput), reading. reading:- readln(X), write(X),nl, not(eof(xinput)), reading. reading:- closefile(xinput).