|
|
B Input and Output
B.1 input
To read in a file in Prolog the following commands are used :
- see(Filename).
-
Open for output the file Filename.
-
seeing(File)
-
When File is a variable, File is unified with the name of the input file.
- get0(C).
-
Reads one character from the input and unifies C to it ASCII code.
- get(C).
-
Reads non blank chars.
- seen.
-
Close the current input file.
- consult(File).
- (also [File]. in some Prologs)
When File is a filemame, loads the Prolog code contained in file in the database.
- reconsult(file).
-
Reload the the Prolog code contained in file in the database.
B.2 Output
To write in a file the following commands are used :
-
tell(Fillename)
-
Open the file for output.
- telling(File).
-
File is unified to the name of the output file.
- put(C).
-
When C an ACSII code Writes the character given by C.
- told.
- Close the current output file.
|
|