Table of Contents
The
function returns a pointer to a stream associated with a file descriptor
returned by the routine The created file is unlinked before returns,
causing the file to be automatically deleted when the last reference to
it is closed. The file is opened with the access value The function returns
a pointer to a file name, in the directory, which did not reference an
existing file at some indeterminate point in the past. is defined in the
include file If the argument is the file name is copied to the buffer
it references. Otherwise, the file name is copied to a static buffer. In
either case, returns a pointer to the file name. The buffer referenced
by is expected to be at least bytes in length. is defined in the include
file The function is similar to but provides the ability to specify
the directory which will contain the temporary file and the file name prefix.
The environment variable (if set), the argument (if and not empty),
the directory and the directory are tried, in the listed order, as directories
in which to store the temporary file. The argument if is used to specify
a file name prefix, which will be the first part of the created file name.
allocates memory in which to store the file name; the returned pointer
may be used as a subsequent argument to
The function returns
a pointer to an open file stream on success, and a pointer on error. The
and functions return a pointer to a file name on success, and a pointer
on error.
The function may fail and set the global variable for
any of the errors specified for the library functions or The function
may fail and set for any of the errors specified for the library function
The function may fail and set for any of the errors specified for the
library functions or
The and functions conform to
These interfaces are provided for System V and compatibility only.
The interface is strongly preferred. There are four important problems
with these interfaces (as well as with the historic interface). First,
there is an obvious race between file name selection and file creation
and deletion. Second, most historic implementations provide only a limited
number of possible temporary file names (usually 26) before file names
will start being recycled. Third, the System V implementations of these
functions (and of use the function to determine whether or not the temporary
file may be created. This has obvious ramifications for setuid or setgid
programs, complicating the portable use of these interfaces in such programs.
Finally, there is no specification of the permissions with which the temporary
files are created. This implementation does not have these flaws, but portable
software cannot depend on that. In particular, the interface should not
be used in software expected to be used on other systems if there is any
possibility that the user does not wish the temporary file to be publicly
readable and writable.
Table of Contents