DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

tmpfile(S)


tmpfile -- create a temporary file

Syntax

cc ... -lc

#include <stdio.h>

FILE *tmpfile ()

Description

The tmpfile function creates a temporary file and returns the corresponding 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]
[FOPEN_MAX] streams are currently open in the calling process.

[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:

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 .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003