I want to add text to a database in prolog. Something like
adding :- tell('a.txt'), write('abc'), told.
but not overwriting the a.txt. I've tried using append like this:
append('a.txt'),write('abc'), told.
but it didn't work. The listener just give a 'no' response and file is not changed. I'm using Amzi Prolog, btw.
Any help will be appreciated.
You have to use these IO predicates: open/3, write/2, close/1.
adding :- open('a.txt', append, Handle), write(Handle, 'abc'), close(Handle).
Check here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With