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

CONFORMING TO

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

NOTES

42       An  error  message  may  be  written  to stdout if the stream cannot be
43       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
52
53
54                                  2001-11-17                        TMPFILE(3)
Impressum