Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie trying to read file

Status
Not open for further replies.

sfontnet

Programmer
Dec 11, 2006
1
US
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
).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top