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.
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

CONFORMING TO

39       SVr4, 4.3BSD, C89, C99, SUSv2, POSIX.1-2001.
40

NOTES

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

SEE ALSO

50       exit(3), mkstemp(3), mktemp(3), tempnam(3), tmpnam(3)
51

COLOPHON

53       This page is part of release 3.22 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)
Impressum