I'm trying to read information from a file. My problem is that I can't exit. It just hangs after the last line of the file is read. My code is below --- any help would be greatly appreciated.
ars_message_parse(_directory, _filename, _outputMessage) :-
(
atomconcat([_directory, '/', _filename], _fullname),
write('The filename is: '),
write(_fullname), nl,
fopen(_fp, _fullname, 'r'),
write('Opening: '),
write(_fullname), nl,
see(_fullname),
repeat,
(
readln(_fp, _firstline),
write('In main file - line is: '),
write(_firstline), nl,
parse_data(_firstline)
),
seen(_fullname),
write('Closing: '),
write(_fullname), nl,
fclose(_fp)
).
parse_data(_readline) :-
(
write('In parse data - line is: '),
write(_readline), nl
).
ars_message_parse(_directory, _filename, _outputMessage) :-
(
atomconcat([_directory, '/', _filename], _fullname),
write('The filename is: '),
write(_fullname), nl,
fopen(_fp, _fullname, 'r'),
write('Opening: '),
write(_fullname), nl,
see(_fullname),
repeat,
(
readln(_fp, _firstline),
write('In main file - line is: '),
write(_firstline), nl,
parse_data(_firstline)
),
seen(_fullname),
write('Closing: '),
write(_fullname), nl,
fclose(_fp)
).
parse_data(_readline) :-
(
write('In parse data - line is: '),
write(_readline), nl
).