OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libstdc++-v3/] [doc/] [html/] [manual/] [ext_io.html] - Diff between revs 816 and 826

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 816 Rev 826
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 39. Input and Output</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      library&#10;    " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part XII.  Extensions" /><link rel="prev" href="ext_iterators.html" title="Chapter 38. Iterators" /><link rel="next" href="ext_demangling.html" title="Chapter 40. Demangling" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 39. Input and Output</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_iterators.html">Prev</a> </td><th width="60%" align="center">Part XII. 
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 39. Input and Output</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      library&#10;    " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part XII.  Extensions" /><link rel="prev" href="ext_iterators.html" title="Chapter 38. Iterators" /><link rel="next" href="ext_demangling.html" title="Chapter 40. Demangling" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 39. Input and Output</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_iterators.html">Prev</a> </td><th width="60%" align="center">Part XII. 
  Extensions
  Extensions
 
 
</th><td width="20%" align="right"> <a accesskey="n" href="ext_demangling.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 39. Input and Output"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.io"></a>Chapter 39. Input and Output</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ext_io.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></div><p>
</th><td width="20%" align="right"> <a accesskey="n" href="ext_demangling.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 39. Input and Output"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.io"></a>Chapter 39. Input and Output</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ext_io.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></div><p>
    Extensions allowing <code class="code">filebuf</code>s to be constructed from
    Extensions allowing <code class="code">filebuf</code>s to be constructed from
    "C" types like  FILE*s and file descriptors.
    "C" types like  FILE*s and file descriptors.
  </p><div class="sect1" title="Derived filebufs"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.io.filebuf_derived"></a>Derived filebufs</h2></div></div></div><p>The v2 library included non-standard extensions to construct
  </p><div class="sect1" title="Derived filebufs"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.io.filebuf_derived"></a>Derived filebufs</h2></div></div></div><p>The v2 library included non-standard extensions to construct
      <code class="code">std::filebuf</code>s from C stdio types such as
      <code class="code">std::filebuf</code>s from C stdio types such as
      <code class="code">FILE*</code>s and POSIX file descriptors.
      <code class="code">FILE*</code>s and POSIX file descriptors.
      Today the recommended way to use stdio types with libstdc++
      Today the recommended way to use stdio types with libstdc++
      IOStreams is via the <code class="code">stdio_filebuf</code> class (see below),
      IOStreams is via the <code class="code">stdio_filebuf</code> class (see below),
      but earlier releases provided slightly different mechanisms.
      but earlier releases provided slightly different mechanisms.
   </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>3.0.x <code class="code">filebuf</code>s have another ctor with this signature:
   </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>3.0.x <code class="code">filebuf</code>s have another ctor with this signature:
        <code class="code">basic_filebuf(__c_file_type*, ios_base::openmode, int_type);
        <code class="code">basic_filebuf(__c_file_type*, ios_base::openmode, int_type);
        </code>
        </code>
         This comes in very handy in a number of places, such as
         This comes in very handy in a number of places, such as
         attaching Unix sockets, pipes, and anything else which uses file
         attaching Unix sockets, pipes, and anything else which uses file
         descriptors, into the IOStream buffering classes.  The three
         descriptors, into the IOStream buffering classes.  The three
         arguments are as follows:
         arguments are as follows:
         </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p><code class="code">__c_file_type*      F   </code>
         </p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p><code class="code">__c_file_type*      F   </code>
              // the __c_file_type typedef usually boils down to stdio's FILE
              // the __c_file_type typedef usually boils down to stdio's FILE
          </p></li><li class="listitem"><p><code class="code">ios_base::openmode  M   </code>
          </p></li><li class="listitem"><p><code class="code">ios_base::openmode  M   </code>
              // same as all the other uses of openmode
              // same as all the other uses of openmode
          </p></li><li class="listitem"><p><code class="code">int_type            B   </code>
          </p></li><li class="listitem"><p><code class="code">int_type            B   </code>
              // buffer size, defaults to BUFSIZ if not specified
              // buffer size, defaults to BUFSIZ if not specified
          </p></li></ul></div><p>
          </p></li></ul></div><p>
         For those wanting to use file descriptors instead of FILE*'s, I
         For those wanting to use file descriptors instead of FILE*'s, I
         invite you to contemplate the mysteries of C's <code class="code">fdopen()</code>.
         invite you to contemplate the mysteries of C's <code class="code">fdopen()</code>.
     </p></li><li class="listitem"><p>In library snapshot 3.0.95 and later, <code class="code">filebuf</code>s bring
     </p></li><li class="listitem"><p>In library snapshot 3.0.95 and later, <code class="code">filebuf</code>s bring
         back an old extension:  the <code class="code">fd()</code> member function.  The
         back an old extension:  the <code class="code">fd()</code> member function.  The
         integer returned from this function can be used for whatever file
         integer returned from this function can be used for whatever file
         descriptors can be used for on your platform.  Naturally, the
         descriptors can be used for on your platform.  Naturally, the
         library cannot track what you do on your own with a file descriptor,
         library cannot track what you do on your own with a file descriptor,
         so if you perform any I/O directly, don't expect the library to be
         so if you perform any I/O directly, don't expect the library to be
         aware of it.
         aware of it.
     </p></li><li class="listitem"><p>Beginning with 3.1, the extra <code class="code">filebuf</code> constructor and
     </p></li><li class="listitem"><p>Beginning with 3.1, the extra <code class="code">filebuf</code> constructor and
         the <code class="code">fd()</code> function were removed from the standard
         the <code class="code">fd()</code> function were removed from the standard
         filebuf.  Instead, <code class="code">&lt;ext/stdio_filebuf.h&gt;</code> contains
         filebuf.  Instead, <code class="code">&lt;ext/stdio_filebuf.h&gt;</code> contains
         a derived class called
         a derived class called
         <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00074.html" target="_top"><code class="code">__gnu_cxx::stdio_filebuf</code></a>.
         <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00074.html" target="_top"><code class="code">__gnu_cxx::stdio_filebuf</code></a>.
         This class can be constructed from a C <code class="code">FILE*</code> or a file
         This class can be constructed from a C <code class="code">FILE*</code> or a file
         descriptor, and provides the <code class="code">fd()</code> function.
         descriptor, and provides the <code class="code">fd()</code> function.
     </p></li></ul></div><p>If you want to access a <code class="code">filebuf</code>'s file descriptor to
     </p></li></ul></div><p>If you want to access a <code class="code">filebuf</code>'s file descriptor to
      implement file locking (e.g. using the <code class="code">fcntl()</code> system
      implement file locking (e.g. using the <code class="code">fcntl()</code> system
      call) then you might be interested in Henry Suter's RWLock class.
      call) then you might be interested in Henry Suter's RWLock class.
 
 
   </p><p>
   </p><p>
    </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ext_iterators.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extensions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ext_demangling.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 38. Iterators </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 40. Demangling</td></tr></table></div></body></html>
    </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ext_iterators.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extensions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ext_demangling.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 38. Iterators </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 40. Demangling</td></tr></table></div></body></html>
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.