1TMPFILE(3) Linux Programmer's Manual TMPFILE(3)
2
3
4
6 tmpfile - create a temporary file
7
9 #include <stdio.h>
10
11 FILE *tmpfile(void);
12
14 The tmpfile() function opens a unique temporary file in binary
15 read/write (w+b) mode. The file will be automatically deleted when it
16 is closed or the program terminates.
17
19 The tmpfile() function returns a stream descriptor, or NULL if a unique
20 filename cannot be generated or the unique file cannot be opened. In
21 the latter case, errno is set to indicate the error.
22
24 EACCES Search permission denied for directory in file's path prefix.
25
26 EEXIST Unable to generate a unique filename.
27
28 EINTR The call was interrupted by a signal.
29
30 EMFILE Too many file descriptors in use by the process.
31
32 ENFILE Too many files open in the system.
33
34 ENOSPC There was no room in the directory to add the new filename.
35
36 EROFS Read-only file system.
37
39 SVr4, 4.3BSD, C89, C99, SUSv2, POSIX.1-2001.
40
42 POSIX.1-2001 specifies: an error message may be written to stdout if
43 the stream cannot be opened.
44
45 The standard does not specify the directory that tmpfile() will use.
46 Glibc will try the path prefix P_tmpdir defined in <stdio.h>, and if
47 that fails the directory /tmp.
48
50 exit(3), mkstemp(3), mktemp(3), tempnam(3), tmpnam(3)
51
53 This page is part of release 3.25 of the Linux man-pages project. A
54 description of the project, and information about reporting bugs, can
55 be found at http://www.kernel.org/doc/man-pages/.
56
57
58
59 2008-07-14 TMPFILE(3)