tmpfile(S) 6 January 1993 tmpfile(S) Name tmpfile - create a temporary file Syntax cc ... -lc #include <stdio.h> FILE *tmpfile () Description The tmpfile function creates a temporary file and returns the corre- sponding FILE pointer. If the file cannot be opened, a NULL pointer is returned. The file is automatically deleted when all references to the file have been closed. The file is opened for update (w+). Diagnostics The tmpfile routine fails if: [EMFILE] [FOPENMAX] streams are currently open in the calling pro- cess. [ENFILE] The system file table is full. [ENOSPC] The directory of file system which would contain the new file cannot be expanded. The tmpfile routine may fail if: [EACCES] Search permission is denied on a component of the path prefix of the file to be created, or write permission is denied for the parent directory of the file to be created. [EINTR] A signal was caught during the tmpfile function. [ENOMEM] Insufficient storage space is available. [ENOTDIR] A component of the path prefix of the file to be created is not a directory. [EROFS] The file to be created would reside on a read-only file system. Note The stream refers to a file that has been unlinked. If the process is killed in the period between file creation and unlinking, a permanent file may be left behind. See also creat(S), fopen(S), mktemp(S), stdio(S), tmpnam(S) unlink(S) Standards conformance tmpfile is conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; ANSI X3.159-1989 Programming Language -- C; IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.