1TMPFILE(3)                 Linux Programmer's Manual                TMPFILE(3)
2
3
4

NAME

6       tmpfile - create a temporary file
7

SYNOPSIS

9       #include <stdio.h>
10
11       FILE *tmpfile(void);
12

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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; see signal(7).
29
30       EMFILE The per-process limit on the number of open file descriptors has
31              been reached.
32
33       ENFILE The system-wide limit on the total number of open files has been
34              reached.
35
36       ENOSPC There was no room in the directory to add the new filename.
37
38       EROFS  Read-only filesystem.
39

ATTRIBUTES

41       For   an   explanation   of   the  terms  used  in  this  section,  see
42       attributes(7).
43
44       ┌──────────┬───────────────┬─────────┐
45Interface Attribute     Value   
46       ├──────────┼───────────────┼─────────┤
47tmpfile() │ Thread safety │ MT-Safe │
48       └──────────┴───────────────┴─────────┘

CONFORMING TO

50       POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD, SUSv2.
51

NOTES

53       POSIX.1-2001 specifies: an error message may be written  to  stdout  if
54       the stream cannot be opened.
55
56       The  standard  does  not specify the directory that tmpfile() will use.
57       Glibc will try the path prefix P_tmpdir defined in  <stdio.h>,  and  if
58       that fails the directory /tmp.
59

SEE ALSO

61       exit(3), mkstemp(3), mktemp(3), tempnam(3), tmpnam(3)
62

COLOPHON

64       This  page  is  part of release 4.16 of the Linux man-pages project.  A
65       description of the project, information about reporting bugs,  and  the
66       latest     version     of     this    page,    can    be    found    at
67       https://www.kernel.org/doc/man-pages/.
68
69
70
71                                  2016-03-15                        TMPFILE(3)
Impressum