add directory Ref-docs
This commit is contained in:
212
Ref-docs/POSIX/susv3/functions/tmpfile.html
Normal file
212
Ref-docs/POSIX/susv3/functions/tmpfile.html
Normal file
@@ -0,0 +1,212 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
||||
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
||||
<title>tmpfile</title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
||||
</script>
|
||||
|
||||
<basefont size="3"> <a name="tmpfile"></a> <a name="tag_03_781"></a><!-- tmpfile -->
|
||||
<!--header start-->
|
||||
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
||||
IEEE Std 1003.1-2001<br>
|
||||
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
||||
|
||||
<!--header end-->
|
||||
<hr size="2" noshade>
|
||||
<h4><a name="tag_03_781_01"></a>NAME</h4>
|
||||
|
||||
<blockquote>tmpfile - create a temporary file</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_02"></a>SYNOPSIS</h4>
|
||||
|
||||
<blockquote class="synopsis">
|
||||
<p><code><tt>#include <<a href="../basedefs/stdio.h.html">stdio.h</a>><br>
|
||||
<br>
|
||||
FILE *tmpfile(void);<br>
|
||||
</tt></code></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_03"></a>DESCRIPTION</h4>
|
||||
|
||||
<blockquote>
|
||||
<div class="box"><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
|
||||
border="0"> The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the
|
||||
requirements described here and the ISO C standard is unintentional. This volume of IEEE Std 1003.1-2001 defers to
|
||||
the ISO C standard. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div>
|
||||
|
||||
<p>The <i>tmpfile</i>() 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 <a href="../functions/fopen.html"><i>fopen</i>()</a>
|
||||
for update (<i>w</i>+).</p>
|
||||
|
||||
<p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> In
|
||||
some implementations, a permanent file may be left behind if the process calling <i>tmpfile</i>() is killed while it is processing
|
||||
a call to <i>tmpfile</i>().</p>
|
||||
|
||||
<p>An error message may be written to standard error if the stream cannot be opened. <img src="../images/opt-end.gif" alt=
|
||||
"[Option End]" border="0"></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_04"></a>RETURN VALUE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>Upon successful completion, <i>tmpfile</i>() shall return a pointer to the stream of the file that is created. Otherwise, it
|
||||
shall return a null pointer <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt=
|
||||
"[Option Start]" border="0"> and set <i>errno</i> to indicate the error. <img src="../images/opt-end.gif" alt="[Option End]"
|
||||
border="0"></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_05"></a>ERRORS</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>The <i>tmpfile</i>() function shall fail if:</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>[EINTR]</dt>
|
||||
|
||||
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> A
|
||||
signal was caught during <i>tmpfile</i>(). <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
||||
|
||||
<dt>[EMFILE]</dt>
|
||||
|
||||
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
||||
{OPEN_MAX} file descriptors are currently open in the calling process. <img src="../images/opt-end.gif" alt="[Option End]" border=
|
||||
"0"></dd>
|
||||
|
||||
<dt>[ENFILE]</dt>
|
||||
|
||||
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
||||
The maximum allowable number of files is currently open in the system. <img src="../images/opt-end.gif" alt="[Option End]" border=
|
||||
"0"></dd>
|
||||
|
||||
<dt>[ENOSPC]</dt>
|
||||
|
||||
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
||||
The directory or file system which would contain the new file cannot be expanded. <img src="../images/opt-end.gif" alt=
|
||||
"[Option End]" border="0"></dd>
|
||||
|
||||
<dt>[EOVERFLOW]</dt>
|
||||
|
||||
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
||||
The file is a regular file and the size of the file cannot be represented correctly in an object of type <b>off_t</b>. <img src=
|
||||
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
||||
</dl>
|
||||
|
||||
<p>The <i>tmpfile</i>() function may fail if:</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>[EMFILE]</dt>
|
||||
|
||||
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
||||
{FOPEN_MAX} streams are currently open in the calling process. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
||||
|
||||
<dt>[ENOMEM]</dt>
|
||||
|
||||
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
||||
Insufficient storage space is available. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
||||
</dl>
|
||||
</blockquote>
|
||||
|
||||
<hr>
|
||||
<div class="box"><em>The following sections are informative.</em></div>
|
||||
|
||||
<h4><a name="tag_03_781_06"></a>EXAMPLES</h4>
|
||||
|
||||
<blockquote>
|
||||
<h5><a name="tag_03_781_06_01"></a>Creating a Temporary File</h5>
|
||||
|
||||
<p>The following example creates a temporary file for update, and returns a pointer to a stream for the created file in the
|
||||
<i>fp</i> variable.</p>
|
||||
|
||||
<pre>
|
||||
<tt>#include <stdio.h>
|
||||
...
|
||||
FILE *fp;
|
||||
<br>
|
||||
fp = tmpfile ();
|
||||
</tt>
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_07"></a>APPLICATION USAGE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>It should be possible to open at least {TMP_MAX} temporary files during the lifetime of the program (this limit may be shared
|
||||
with <a href="../functions/tmpnam.html"><i>tmpnam</i>()</a>) 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}).</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_08"></a>RATIONALE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_09"></a>FUTURE DIRECTIONS</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_10"></a>SEE ALSO</h4>
|
||||
|
||||
<blockquote>
|
||||
<p><a href="fopen.html"><i>fopen</i>()</a> , <a href="tmpnam.html"><i>tmpnam</i>()</a> , <a href="unlink.html"><i>unlink</i>()</a>
|
||||
, the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/stdio.h.html"><i><stdio.h></i></a></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_11"></a>CHANGE HISTORY</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>First released in Issue 1. Derived from Issue 1 of the SVID.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_12"></a>Issue 5</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>Large File Summit extensions are added.</p>
|
||||
|
||||
<p>The last two paragraphs of the DESCRIPTION were included as APPLICATION USAGE notes in previous issues.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_781_13"></a>Issue 6</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>Extensions beyond the ISO C standard are marked.</p>
|
||||
|
||||
<p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>In the ERRORS section, the [EOVERFLOW] condition is added. This change is to support large files.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>The [EMFILE] optional error condition is added.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>The APPLICATION USAGE section is added for alignment with the ISO/IEC 9899:1999 standard.</p>
|
||||
</blockquote>
|
||||
|
||||
<div class="box"><em>End of informative text.</em></div>
|
||||
|
||||
<hr>
|
||||
<hr size="2" noshade>
|
||||
<center><font size="2"><!--footer start-->
|
||||
UNIX ® is a registered Trademark of The Open Group.<br>
|
||||
POSIX ® is a registered Trademark of The IEEE.<br>
|
||||
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
||||
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
||||
]</font></center>
|
||||
|
||||
<!--footer end-->
|
||||
<hr size="2" noshade>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user