]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
3 | .\" Permission is granted to make and distribute verbatim copies of this | |
4 | .\" manual provided the copyright notice and this permission notice are | |
5 | .\" preserved on all copies. | |
6 | .\" | |
7 | .\" Permission is granted to copy and distribute modified versions of this | |
8 | .\" manual under the conditions for verbatim copying, provided that the | |
9 | .\" entire resulting derived work is distributed under the terms of a | |
10 | .\" permission notice identical to this one. | |
c13182ef | 11 | .\" |
fea681da MK |
12 | .\" Since the Linux kernel and libraries are constantly changing, this |
13 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
14 | .\" responsibility for errors or omissions, or for damages resulting from | |
15 | .\" the use of the information contained herein. The author(s) may not | |
16 | .\" have taken the same level of care in the production of this manual, | |
17 | .\" which is licensed free of charge, as they might when working | |
18 | .\" professionally. | |
c13182ef | 19 | .\" |
fea681da MK |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
22 | .\" | |
23 | .\" References consulted: | |
24 | .\" Linux libc source code | |
25 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
26 | .\" 386BSD man pages | |
27 | .\" Modified Sat Jul 24 17:46:57 1993 by Rik Faith (faith@cs.unc.edu) | |
28 | .\" Modified 2001-11-17, aeb | |
29 | .TH TMPFILE 3 2001-11-17 "" "Linux Programmer's Manual" | |
30 | .SH NAME | |
31 | tmpfile \- create a temporary file | |
32 | .SH SYNOPSIS | |
33 | .nf | |
34 | .B #include <stdio.h> | |
35 | .sp | |
18a2cc04 | 36 | .B FILE *tmpfile(void); |
fea681da MK |
37 | .fi |
38 | .SH DESCRIPTION | |
af8d55f9 MK |
39 | The \fBtmpfile\fP() function opens a unique temporary file |
40 | in binary read/write (w+b) mode. | |
fea681da | 41 | The file will be automatically deleted when it is closed or the |
af8d55f9 | 42 | program terminates. |
fea681da | 43 | .SH "RETURN VALUE" |
63aa9df0 | 44 | The \fBtmpfile\fP() function returns a stream descriptor, or NULL if |
fea681da | 45 | a unique filename cannot be generated or the unique file cannot be |
c13182ef MK |
46 | opened. |
47 | In the latter case, \fIerrno\fP is set to indicate the error. | |
fea681da | 48 | .SH ERRORS |
c13182ef | 49 | .TP |
fea681da MK |
50 | .B EACCES |
51 | Search permission denied for directory in file's path prefix. | |
52 | .TP | |
53 | .B EEXIST | |
54 | Unable to generate a unique filename. | |
55 | .TP | |
56 | .B EINTR | |
57 | The call was interrupted by a signal. | |
58 | .TP | |
59 | .B EMFILE | |
60 | Too many file descriptors in use by the process. | |
61 | .TP | |
62 | .B ENFILE | |
63 | Too many files open in the system. | |
64 | .TP | |
65 | .B ENOSPC | |
66 | There was no room in the directory to add the new filename. | |
67 | .TP | |
68 | .B EROFS | |
69 | Read-only filesystem. | |
70 | .SH "CONFORMING TO" | |
68e1685c | 71 | SVr4, 4.3BSD, C89, C99, SUSv2, POSIX.1-2001. |
fea681da MK |
72 | .SH NOTES |
73 | An error message may be written to \fIstdout\fP if the stream | |
74 | cannot be opened. | |
75 | .LP | |
63aa9df0 | 76 | The standard does not specify the directory that \fItmpfile\fP() |
c13182ef MK |
77 | will use. |
78 | Glibc will try the path prefix \fIP_tmpdir\fP defined | |
fea681da MK |
79 | in \fI<stdio.h>\fP, and if that fails the directory \fI/tmp\fP. |
80 | .SH "SEE ALSO" | |
81 | .BR exit (3), | |
82 | .BR mkstemp (3), | |
83 | .BR mktemp (3), | |
84 | .BR tempnam (3), | |
85 | .BR tmpnam (3) |