.. meta::
   :keywords: OEWriteSurface

.. oe:namespace:: OESpicoli

.. oe:function:: OEWriteSurface

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

      .. oe:api::

         bool OEWriteSurface(const std::string& fname, const OESurface& surf)
         bool OEWriteSurface(OEPlatform::oeostream& ofs, const OESurface& surf,
                             unsigned int type)

   .. oe:language:: python

      .. oe:api:: python

         OEWriteSurface(fname: str, surf: OESurface) -> bool
         OEWriteSurface(ofs: oeostream, surf: OESurface, type: int) -> bool

   Write surf to the surface file ``fname``. Returns ``false`` if
   ``fname`` is not a valid surface file name. This will overwrite the
   previous file if it existed.

   The overload that takes an :oe:func:`OEPlatform::oeostream` can be
   used to write multiple surfaces to the same destination. Note that
   the format must be specified by a constant from the
   :oe:constns:`OESpicoli::OESurfaceFileType` namespace as the type
   argument. The :oe:const:`OESpicoli::OESurfaceFileType::Grasp` format
   does not support this kind of use. Returns ``true`` if written
   successfully.

