首页 > 解决方案 > 在 mosel 中创建临时文件的惯用方法是什么?

问题描述

我正在寻找类似于 R/Python 中的 tempfile 函数的东西: https://docs.python.org/3/library/tempfile.html https://www.rdocumentation.org/packages/base/versions/3.6 .1/主题/临时文件

这在摩泽尔有吗?

标签: temporary-filesmosel

解决方案


您可以使用 I/O 驱动程序“tmp:”在 Mosel 实例的临时目录中创建一个文件,可能结合函数“newmuid”创建一个唯一标识符作为文件名,例如:

tmpfname:="tmp:"+newmuid
fopen(tmpfname, F_OUTPUT)
writeln("This line is written into the temporary file")
fclose(F_OUTPUT)

推荐阅读