📄 tempnam.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>tempnam</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_009_528"> </a>NAME</h4><blockquote>tempnam - create a name for a temporary file</blockquote><h4><a name = "tag_000_009_529"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="stdio.h.html">stdio.h</a>>char *tempnam(const char *<i>dir</i>, const char *<i>pfx</i>);</code></pre></blockquote><h4><a name = "tag_000_009_530"> </a>DESCRIPTION</h4><blockquote>The<i>tempnam()</i>function generates a pathname that may be used for a temporary file.<p>The<i>tempnam()</i>function allows the user to control the choice of a directory. The<i>dir</i>argument points to the name of the directory in which the file is to becreated. If<i>dir</i>is a null pointeror points to a string which is not a namefor an appropriate directory, the path prefix defined as{P_tmpdir} in the<i><a href="stdio.h.html"><stdio.h></a></i>header is used.If that directory is not accessible,an implementation-dependent directory may be used.<p>Many applications prefer their temporary files to have certaininitial letter sequences in their names.The<i>pfx</i>argument should be used for this.This argument may be a null pointer or point to a stringof up to five bytes to be used as the beginning of the filename.<p>Some implementations of<i>tempnam()</i>may use<i><a href="tmpnam.html">tmpnam()</a></i>internally. On such implementations, if called more than {TMP_MAX}times in a single process, the behaviour is implementation-dependent.</blockquote><h4><a name = "tag_000_009_531"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>tempnam()</i>allocates space for a string, puts the generated pathname in thatspace and returns a pointer to it.The pointer is suitable for use in a subsequent call to<i><a href="free.html">free()</a></i>.Otherwise it returns a null pointer and sets<i>errno</i>to indicate the error.</blockquote><h4><a name = "tag_000_009_532"> </a>ERRORS</h4><blockquote>The<i>tempnam()</i>function will fail if:<dl compact><dt>[ENOMEM]<dd>Insufficient storage space is available.</dl></blockquote><h4><a name = "tag_000_009_533"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_009_534"> </a>APPLICATION USAGE</h4><blockquote>This function only creates pathnames.It is the application's responsibility to create and remove the files.Between the time a pathname is created and the file is opened, itis possible for some other process to create a file with the same name.Applications may find<i><a href="tmpfile.html">tmpfile()</a></i>more useful.</blockquote><h4><a name = "tag_000_009_535"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_009_536"> </a>SEE ALSO</h4><blockquote><i><a href="fopen.html">fopen()</a></i>,<i><a href="free.html">free()</a></i>,<i><a href="open.html">open()</a></i>,<i><a href="tmpfile.html">tmpfile()</a></i>,<i><a href="tmpnam.html">tmpnam()</a></i>,<i><a href="unlink.html">unlink()</a></i>,<i><a href="stdio.h.html"><stdio.h></a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -