For example, here is a small program to read data from a file and print it to the screen. The 'Data' variable in the program should take values which are Prolog terms. For example, the 'File' could contain a Prolog program, or a sequence of numbers. A file of numbers would have to be formatted as in the following display.
Subsequent writing goes to that file via the port or stream.
Then satisfying 'told' closes the file and the association of the port or stream with the file. Exercise 2.10 Design a Prolog program that can open and copy a file of Prolog objects from one file to another file. Prolog Code for this section.