man-pages/man3/tmpfile.3.html
2021-03-31 01:06:50 +01:00

171 lines
3.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of TMPFILE</TITLE>
</HEAD><BODY>
<H1>TMPFILE</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 2016-03-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
tmpfile - create a temporary file
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/stdio.h">stdio.h</A>&gt;</B>
<B>FILE *tmpfile(void);</B>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<B>tmpfile</B>()
function opens a unique temporary file
in binary read/write (w+b) mode.
The file will be automatically deleted when it is closed or the
program terminates.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
The
<B>tmpfile</B>()
function returns a stream descriptor, or NULL if
a unique filename cannot be generated or the unique file cannot be
opened.
In the latter case,
<I>errno</I>
is set to indicate the error.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="1"><B>EACCES</B>
<DD>
Search permission denied for directory in file's path prefix.
<DT id="2"><B>EEXIST</B>
<DD>
Unable to generate a unique filename.
<DT id="3"><B>EINTR</B>
<DD>
The call was interrupted by a signal; see
<B><A HREF="/cgi-bin/man/man2html?7+signal">signal</A></B>(7).
<DT id="4"><B>EMFILE</B>
<DD>
The per-process limit on the number of open file descriptors has been reached.
<DT id="5"><B>ENFILE</B>
<DD>
The system-wide limit on the total number of open files has been reached.
<DT id="6"><B>ENOSPC</B>
<DD>
There was no room in the directory to add the new filename.
<DT id="7"><B>EROFS</B>
<DD>
Read-only filesystem.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>ATTRIBUTES</H2>
For an explanation of the terms used in this section, see
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
<TABLE BORDER>
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
<TR VALIGN=top><TD>
<B>tmpfile</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
</TABLE>
<A NAME="lbAH">&nbsp;</A>
<H2>CONFORMING TO</H2>
POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD, SUSv2.
<A NAME="lbAI">&nbsp;</A>
<H2>NOTES</H2>
POSIX.1-2001 specifies:
an error message may be written to
<I>stdout</I>
if the stream
cannot be opened.
<P>
The standard does not specify the directory that
<B>tmpfile</B>()
will use.
Glibc will try the path prefix
<I>P_tmpdir</I>
defined
in
<I>&lt;<A HREF="file:///usr/include/stdio.h">stdio.h</A>&gt;</I>,
and if that fails the directory
<I>/tmp</I>.
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+exit">exit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+mkstemp">mkstemp</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+mktemp">mktemp</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+tempnam">tempnam</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+tmpnam">tmpnam</A></B>(3)
<A NAME="lbAK">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="8"><A HREF="#lbAB">NAME</A><DD>
<DT id="9"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="10"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="11"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="12"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="13"><A HREF="#lbAG">ATTRIBUTES</A><DD>
<DT id="14"><A HREF="#lbAH">CONFORMING TO</A><DD>
<DT id="15"><A HREF="#lbAI">NOTES</A><DD>
<DT id="16"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="17"><A HREF="#lbAK">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:58 GMT, March 31, 2021
</BODY>
</HTML>