tmpfile - create a temporary file
The tmpfile() function creates a temporary file and opens a
corresponding stream. The file will automatically be
deleted when all references to the file are closed. The
file is opened as in fopen(3C) for update (w+).
The largest value that can be represented correctly in an
object of type off_t will be established as the offset max-
imum in the open file description.
Upon successful completion, tmpfile() returns a pointer to
the stream of the file that is created. Otherwise, it
returns a null pointer and sets errno to indicate the error.
The tmpfile() function will fail if:
EINTR A signal was caught during the execution of tmpfile().
There are OPEN_MAX file descriptors currently open in
the calling process.
The maximum allowable number of files is currently
open in the system.
The directory or file system which would contain the
new file cannot be expanded.
The tmpfile() function may fail if:
There are FOPEN_MAX streams currently open in the cal-
Insufficient storage space is available.
The stream refers to a file which is unlinked. If the pro-
cess is killed in the period between file creation and
unlinking, a permanent file may be left behind.
The tmpfile() function has a transitional interface for 64-
bit file offsets. See lf64(5).
When a UFS file system is mounted with logging enabled, file
system transactions that free blocks from files might not
actually add those freed blocks to the file system's free
list until some unspecified time in the future. This
behavior improves file system performance but does not con-
form to the POSIX, Single UNIX Specification, SPARC Confor-
mance Definition, System V Application Binary Interface,
System V Interface Definition, and X/Open Portability Guide
Standards, which require that freed space be available
immediately. To enable standards conformance regarding file
deletions or to address the problem of not being able to
grow files on a relatively full UFS file system even after
files have been deleted, disable UFS logging (see
mount_ufs(1M), unlink(2), fopen(3C), tmpnam(3C), lf64(5)
Man(1) output converted with