next up previous

12.4.2.2 Close

The close function closes a file stream previously opened with the open command. The file is specified by a logical name previously attached to the desired stream.

Syntax

(close [<logical-name>])

If close is called without arguments, all open files will be closed. The user is responsible for closing all files opened during execution. If files are not closed, the contents are not guaranteed correct, however, CLIPS will attempt to close all open files when the exit command is executed. The close function returns TRUE if any files were successfully closed, otherwise FALSE.

Example

CLIPS> (open "myfile.clp" writeFile "w")
TRUE
CLIPS> (open "MS-DOS\\directory\\file.clp" readFile)
TRUE
CLIPS> (close writeFile)
TRUE
CLIPS> (close writeFile)
FALSE
CLIPS> (close)
TRUE
CLIPS> (close)
FALSE
CLIPS>


next up previous