home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
prolog
/
library
/
prolo_c
/
exampl43.pro
< prev
next >
Wrap
Text File
|
1986-10-06
|
859b
|
34 lines
/* Program 43 */
/*
Read 'The Turbo Prolog File System' in chapter
9 . This example is on page 102.
*/
domains
file = myfile
predicates
start
readin(char)
goal
start.
clauses
start:-
write("This program reads input\nfrom the keyboard and\nwrites it to TRYFILE.ONE.\n"),
write("Press # when done entering:\n"),
openwrite(myfile,"tryfile.one"),
readchar(X),
readin(X),
closefile(myfile),
writedevice(screen),
write("Your input has been transferred to a file").
readin( '#' ):-!.
readin('\13'):-!,writedevice(myfile),
write("\13\10"),writedevice(screen),
write("\13\10"),readchar(X),readin(X).
readin( X ):- writedevice(myfile),
write(X),writedevice(screen),
write(X),readchar(Y),readin(Y).