<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="bson_reader_new_from_fd">
  <info>
    <link type="guide" xref="bson_reader_t" group="function"/>
  </info>
  <title>bson_reader_new_from_fd()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[bson_reader_t *
bson_reader_new_from_fd (int  fd,
                         bool close_on_destroy);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p><code>fd</code></p></td><td><p>A valid file-descriptor.</p></td></tr>
      <tr><td><p><code>close_on_destroy</code></p></td><td><p>true if <code>fd</code> should be <code>close()</code>'d when the reader is destroyed.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>The <link xref="bson_reader_new_from_fd">bson_reader_new_from_fd()</link> function shall create a new <link xref="bson_reader_t">bson_reader_t</link> that will read from the provided file-descriptor.</p>
    <p>_fd_ <em>MUST</em> be in blocking mode.</p>
    <p>If <code>close_fd</code> is true, then <code>fd</code> will be closed when the <link xref="bson_reader_t">bson_reader_t</link> is destroyed with <link xref="bson_reader_destroy">bson_reader_destroy()</link>.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>A newly allocated <link xref="bson_reader_t">bson_reader_t</link> that should be freed with <link xref="bson_reader_destroy">bson_reader_destroy</link>.</p>
  </section>

</page>
