encryption - Swi Prolog Read Write with Files -


so i've been trying make encryption predicate , got work input keyboared , standard output i'm failing make work files,so need fixing it. need take text in messagefile apply encryption , write outfile.

encrypt(messagefile,key,outfile):- read(x),q(x,key,r),!,string_to_list(s,r), write(s). 

as said works standard input\output:

9 ?- encrypt(x,a,y).  |   abcdef.               bcdefg            true. 

if relevant , .pl file in.txt , out.txt in d:\folder

you can open file with:

open(messagefile, read, read), 

you can use read/2 read prolog term file stream:

read(read, term), 

ps: notice string_to_list/2 deprecated , string_codes/2 up-to-date equivalent.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -