.. oe:namespace:: OEPlatform



.. meta::
   :keywords: oeiofstream, iofstream


.. _OEPlatform_oeiofstream:

.. oe:class:: oeiofstream

   .. oe:api::


      class oeiofstream : public oeofstream

   This class represents a file that can be both written to and read
   from at the same time. Note, it inherits from
   :ref:`oeofstream <OEPlatform_oeofstream>` and can generally be used as an
   output file stream. The major distinction being that the
   :oe:meth:`OEPlatform::oeiofstream::pread` method can be used to read
   data back from the file provided
   :oe:meth:`OEPlatform::oeostream::flush` has been called. 

   The following methods are publicly inherited from :ref:`oeofstream <OEPlatform_oeofstream>`:

   ================================================= ================================================ =================================================
   :oe:meth:`append<OEPlatform::oeofstream::append>` :oe:meth:`fd<OEPlatform::oeofstream::fd>`        :oe:meth:`openfd<OEPlatform::oeofstream::openfd>`
   ================================================= ================================================ =================================================

   .. oe:method:: Constructors

      .. oe:language:: c++ java csharp

         .. oe:api::

            oeiofstream()
            oeiofstream(const char* filename)
            oeiofstream(const std::string& filename)

      .. oe:language:: python

         .. oe:api:: python

            oeiofstream() -> oeiofstream
            oeiofstream(filename: str) -> oeiofstream

      Default and copy constructors.

   .. oe:method:: pread

      .. oe:language:: c++ java csharp

         .. oe:api::

            oesize_t pread(char* buffer, oesize_t len, oefpos_t offset) const

      .. oe:language:: python

         .. oe:api:: python

            pread(buffer: str, len: oesize_t, offset: oefpos_t) -> oesize_t

      Reads 'len' bytes into 'buffer' at the specified 'offset' in the
      file. Returns the number of bytes actually read. This method
      allows multiple threads to safely read from a single file
      descriptor. 

      .. warning:: 
         
         The ``flush`` method must be called before data written to
         this stream can be seen by the ``pread`` method. 

