save_module(+atom_name, +atom_file)

Write all the clauses of a compiled module to a file. The first argument is the name of the module to save, the second is the name of the file which will be created or overwritten with the data from the module. The filename must be enclosed by single or double quotes.

Filenames

As can be seen from the example below two backslash characters are used to separate folders, two backslash characters are used to make sure that a part of a filename is not interpreted as an escape sequence, for instance each '\t' character sequence is replaced by the compiler by a single tab character. For more information about this see escape sequences and symbolic control characters.

see also: active_module/1 check_singleton/1 close_all_modules/0 close_module/1 consult/0 consult/1 consult/3 create_module/1 create_module/2 ensure_loaded/1 include/1 module/3 module_name/2 modules open_module/0 open_module/1 open_module/3 open_module_search/3 open_standard_module/2 save_module/1 save_module/3 set_active_module/0 set_active_module/1 this_module/3

Example
save_module(m1, "c:\\mod1.txt"). the clauses of the module 'm23' are written to the file "c:\module1.txt"

 

Exceptions
the argument is a variable  a instantiation_error exception is thrown
the argument is not an atom a type_error(atom, A) exception is thrown
the open-mode is not readwrite a permission_error(save, module, A) exception is thrown
no module with the specified name a existence_error(module, A) exception is thrown
error while writing to file  a permission_error(write, file, A) exception is thrown

 

 

info@trinc-prolog.com