~ubuntu-branches/ubuntu/intrepid/manpages-posix/intrepid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "TMPFILE" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" tmpfile 
.SH NAME
tmpfile \- create a temporary file
.SH SYNOPSIS
.LP
\fB#include <stdio.h>
.br
.sp
FILE *tmpfile(void);
.br
\fP
.SH DESCRIPTION
.LP
The \fItmpfile\fP() function shall create a temporary file and open
a corresponding stream. The file shall be automatically
deleted when all references to the file are closed. The file is opened
as in \fIfopen\fP()
for update (\fIw\fP+).
.LP
In
some implementations, a permanent file may be left behind if the process
calling \fItmpfile\fP() is killed while it is processing
a call to \fItmpfile\fP().
.LP
An error message may be written to standard error if the stream cannot
be opened. 
.SH RETURN VALUE
.LP
Upon successful completion, \fItmpfile\fP() shall return a pointer
to the stream of the file that is created. Otherwise, it
shall return a null pointer   \ and set \fIerrno\fP to indicate the
error. 
.SH ERRORS
.LP
The \fItmpfile\fP() function shall fail if:
.TP 7
.B EINTR
A
signal was caught during \fItmpfile\fP(). 
.TP 7
.B EMFILE
{OPEN_MAX} file descriptors are currently open in the calling process.
.TP 7
.B ENFILE
The maximum allowable number of files is currently open in the system.
.TP 7
.B ENOSPC
The directory or file system which would contain the new file cannot
be expanded. 
.TP 7
.B EOVERFLOW
The file is a regular file and the size of the file cannot be represented
correctly in an object of type \fBoff_t\fP. 
.sp
.LP
The \fItmpfile\fP() function may fail if:
.TP 7
.B EMFILE
{FOPEN_MAX} streams are currently open in the calling process. 
.TP 7
.B ENOMEM
Insufficient storage space is available. 
.sp
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.SS Creating a Temporary File
.LP
The following example creates a temporary file for update, and returns
a pointer to a stream for the created file in the
\fIfp\fP variable.
.sp
.RS
.nf

\fB#include <stdio.h>
\&...
FILE *fp;
.sp

fp = tmpfile ();
\fP
.fi
.RE
.SH APPLICATION USAGE
.LP
It should be possible to open at least {TMP_MAX} temporary files during
the lifetime of the program (this limit may be shared
with \fItmpnam\fP()) and there should be no limit on the number simultaneously
open other
than this limit and any limit on the number of open files ( {FOPEN_MAX}).
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIfopen\fP() , \fItmpnam\fP() , \fIunlink\fP()
, the Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI<stdio.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .