• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/libc/
1<html lang="en">
2<head>
3<title>tmpnam - Untitled</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Untitled">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Stdio.html#Stdio" title="Stdio">
9<link rel="prev" href="tmpfile.html#tmpfile" title="tmpfile">
10<link rel="next" href="ungetc.html#ungetc" title="ungetc">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<meta http-equiv="Content-Style-Type" content="text/css">
13<style type="text/css"><!--
14  pre.display { font-family:inherit }
15  pre.format  { font-family:inherit }
16  pre.smalldisplay { font-family:inherit; font-size:smaller }
17  pre.smallformat  { font-family:inherit; font-size:smaller }
18  pre.smallexample { font-size:smaller }
19  pre.smalllisp    { font-size:smaller }
20  span.sc    { font-variant:small-caps }
21  span.roman { font-family:serif; font-weight:normal; } 
22  span.sansserif { font-family:sans-serif; font-weight:normal; } 
23--></style>
24<link rel="stylesheet" type="text/css" href="../cs.css">
25</head>
26<body>
27<div class="node">
28<a name="tmpnam"></a>
29<p>
30Next:&nbsp;<a rel="next" accesskey="n" href="ungetc.html#ungetc">ungetc</a>,
31Previous:&nbsp;<a rel="previous" accesskey="p" href="tmpfile.html#tmpfile">tmpfile</a>,
32Up:&nbsp;<a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a>
33<hr>
34</div>
35
36<h3 class="section">4.65 <code>tmpnam</code>, <code>tempnam</code>&mdash;name for a temporary file</h3>
37
38<p><a name="index-tmpnam-317"></a><a name="index-tempnam-318"></a><a name="index-g_t_005ftmpnam_005fr-319"></a><a name="index-g_t_005ftempnam_005fr-320"></a><strong>Synopsis</strong>
39<pre class="example">     #include &lt;stdio.h&gt;
40     char *tmpnam(char *<var>s</var>);
41     char *tempnam(char *<var>dir</var>, char *<var>pfx</var>);
42     char *_tmpnam_r(struct _reent *<var>reent</var>, char *<var>s</var>);
43     char *_tempnam_r(struct _reent *<var>reent</var>, char *<var>dir</var>, char *<var>pfx</var>);
44     
45</pre>
46   <p><strong>Description</strong><br>
47Use either of these functions to generate a name for a temporary file. 
48The generated name is guaranteed to avoid collision with other files
49(for up to <code>TMP_MAX</code> calls of either function).
50
51   <p><code>tmpnam</code> generates file names with the value of <code>P_tmpdir</code>
52(defined in `<code>stdio.h</code>') as the leading directory component of the path.
53
54   <p>You can use the <code>tmpnam</code> argument <var>s</var> to specify a suitable area
55of memory for the generated filename; otherwise, you can call
56<code>tmpnam(NULL)</code> to use an internal static buffer.
57
58   <p><code>tempnam</code> allows you more control over the generated filename: you
59can use the argument <var>dir</var> to specify the path to a directory for
60temporary files, and you can use the argument <var>pfx</var> to specify a
61prefix for the base filename.
62
63   <p>If <var>dir</var> is <code>NULL</code>, <code>tempnam</code> will attempt to use the value of
64environment variable <code>TMPDIR</code> instead; if there is no such value,
65<code>tempnam</code> uses the value of <code>P_tmpdir</code> (defined in `<code>stdio.h</code>').
66
67   <p>If you don't need any particular prefix to the basename of temporary
68files, you can pass <code>NULL</code> as the <var>pfx</var> argument to <code>tempnam</code>.
69
70   <p><code>_tmpnam_r</code> and <code>_tempnam_r</code> are reentrant versions of <code>tmpnam</code>
71and <code>tempnam</code> respectively.  The extra argument <var>reent</var> is a
72pointer to a reentrancy structure.
73
74   <p><br>
75<strong>Warnings</strong><br>
76The generated filenames are suitable for temporary files, but do not
77in themselves make files temporary.  Files with these names must still
78be explicitly removed when you no longer want them.
79
80   <p>If you supply your own data area <var>s</var> for <code>tmpnam</code>, you must ensure
81that it has room for at least <code>L_tmpnam</code> elements of type <code>char</code>.
82
83   <p><br>
84<strong>Returns</strong><br>
85Both <code>tmpnam</code> and <code>tempnam</code> return a pointer to the newly
86generated filename.
87
88   <p><br>
89<strong>Portability</strong><br>
90ANSI C requires <code>tmpnam</code>, but does not specify the use of
91<code>P_tmpdir</code>.  The System V Interface Definition (Issue 2) requires
92both <code>tmpnam</code> and <code>tempnam</code>.
93
94   <p>Supporting OS subroutines required: <code>close</code>,  <code>fstat</code>, <code>getpid</code>,
95<code>isatty</code>, <code>lseek</code>, <code>open</code>, <code>read</code>, <code>sbrk</code>, <code>write</code>.
96
97   <p>The global pointer <code>environ</code> is also required.
98
99   <p><br>
100
101   </body></html>
102
103