TMPFILE(3C) | Standard C Library Functions | TMPFILE(3C) |
tmpfile - create a temporary file
#include <stdio.h> FILE *tmpfile(void);
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 maximum 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
EMFILE
ENFILE
ENOSPC
The tmpfile() function may fail if:
EMFILE
ENOMEM
The stream refers to a file which is unlinked. If the process 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(7).
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Standard |
unlink(2), fopen(3C), mkstemp(3C), mktemp(3C), tmpnam(3C), lf64(7), standards(7)
August 4, 2003 | OmniOS |