blob: cddc24f5541b889f1513a693c05b92eee2ea7067 [file]
<html lang="en">
<head>
<title>fdopen - 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="fcloseall.html#fcloseall" title="fcloseall">
<link rel="next" href="feof.html#feof" title="feof">
<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="fdopen"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="feof.html#feof">feof</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="fcloseall.html#fcloseall">fcloseall</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a>
<hr>
</div>
<h3 class="section">4.6 <code>fdopen</code>&mdash;turn open file into a stream</h3>
<p><a name="index-fdopen-158"></a><a name="index-g_t_005ffdopen_005fr-159"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;stdio.h&gt;
FILE *fdopen(int <var>fd</var>, const char *<var>mode</var>);
FILE *_fdopen_r(struct _reent *<var>reent</var>,
int <var>fd</var>, const char *<var>mode</var>);
</pre>
<p><strong>Description</strong><br>
<code>fdopen</code> produces a file descriptor of type <code>FILE *</code>, from a
descriptor for an already-open file (returned, for example, by the
system subroutine <code>open</code> rather than by <code>fopen</code>).
The <var>mode</var> argument has the same meanings as in <code>fopen</code>.
<p><br>
<strong>Returns</strong><br>
File pointer or <code>NULL</code>, as for <code>fopen</code>.
<p><br>
<strong>Portability</strong><br>
<code>fdopen</code> is ANSI.
<p><br>
</body></html>