| <html lang="en"> |
| <head> |
| <title>tmpfile - Untitled</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Untitled"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Stdio.html#Stdio" title="Stdio"> |
| <link rel="prev" href="swscanf.html#swscanf" title="swscanf"> |
| <link rel="next" href="tmpnam.html#tmpnam" title="tmpnam"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="tmpfile"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="tmpnam.html#tmpnam">tmpnam</a>, |
| Previous: <a rel="previous" accesskey="p" href="swscanf.html#swscanf">swscanf</a>, |
| Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">4.64 <code>tmpfile</code>—create a temporary file</h3> |
| |
| <p><a name="index-tmpfile-315"></a><a name="index-g_t_005ftmpfile_005fr-316"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <stdio.h> |
| FILE *tmpfile(void); |
| |
| FILE *_tmpfile_r(struct _reent *<var>reent</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| Create a temporary file (a file which will be deleted automatically), |
| using a name generated by <code>tmpnam</code>. The temporary file is opened with |
| the mode <code>"wb+"</code>, permitting you to read and write anywhere in it |
| as a binary file (without any data transformations the host system may |
| perform for text files). |
| |
| <p>The alternate function <code>_tmpfile_r</code> is a reentrant version. The |
| argument <var>reent</var> is a pointer to a reentrancy structure. |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| <code>tmpfile</code> normally returns a pointer to the temporary file. If no |
| temporary file could be created, the result is NULL, and <code>errno</code> |
| records the reason for failure. |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| Both ANSI C and the System V Interface Definition (Issue 2) require |
| <code>tmpfile</code>. |
| |
| <p>Supporting OS subroutines required: <code>close</code>, <code>fstat</code>, <code>getpid</code>, |
| <code>isatty</code>, <code>lseek</code>, <code>open</code>, <code>read</code>, <code>sbrk</code>, <code>write</code>. |
| |
| <p><code>tmpfile</code> also requires the global pointer <code>environ</code>. |
| |
| <p><br> |
| |
| </body></html> |
| |