CreateTemporary

CreateTemporary[]
creates a temporary file with a unique name in the default temporary directory and returns the name of the file.

DetailsDetails

  • CreateTemporary only creates the file; it does not open it.
  • The file created can subsequently be opened for reading or writing in binary or text mode.
  • CreateTemporary returns the full name of the file it creates or $Failed if it cannot create the file.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Create a temporary file:

In[1]:=
Click for copyable input
Out[1]=

The file remains closed:

In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Introduced in 2012
(9.0)