[top] [up] [next]

Opening standard modules


To open a standard module (a module that contains predefined predicates and/or prolog classes) there is a special predicate for which it is not necessary to specify a path for the file to open. The advantage of using this predicate is that prolog programs that use it will not contain fixed paths to a folder containing the standard modules.

    open_standardmodule(<internal-name>, <file-name-surrounded-by-(single)quotes>).

The first argument is the internal name of the module, the second argument is the name of the file enclosed by single or double quotes. It is not necessary to specify an absolute or relative path to the file, the Prolog interpreter will search up in the folder hierarchy from where the executable file is installed. The interpreter searches for a folder with the name 'modules' and the specified file in it.

Examples: 

    open_standardmodule(object, "object.txt").

The predicate only needs two arguments because a standard module is always opened in read-only mode and a complete path is not necessary, just the name of the file.

[top] [up] [next]

 

info@trinc-prolog.com