tmp: accessing the temporary directory of Mosel
The driver tmp is an extension to the default driver that locates the specified file in the temporary directory used by Mosel. For example, we might wish to compile a submodel file to a BIM file located in the temporary directory:
if compile("", "burglar.mos", "tmp:burglar.bim")<>0 then exit(1); end-if load(modBurg, "tmp:burglar.bim") ! Load the BIM file
The same can be achieved with the following library commands (Mosel C libraries):
XPRMcompmod(NULL, "burglar.mos", "tmp:burglar.bim", "Burglar example"); mod = XPRMloadmod("tmp:burglar.bim",NULL); /* Load the BIM file */
The tmp driver can also be used with the library interfaces to other programming languages, such as the Mosel Java library:
mosel.compile("", "burglar2.mos", "tmp:burglar2.bim", ""); mod = mosel.loadModel("tmp:burglar2.bim");
Mosel's temporary directory is located in the system temporary directory, its actual definition depends on the system that is used for running Mosel and can be retrieved via the Mosel function getparam.
writeln("Temporary directory: ", getparam("tmpdir") )