Creating a .red File
--------------------

The .red file API is exposed through the ``RED::IREDFile`` interface. To create an instance of a .red file, you need to use the ``RED::Factory``:

.. code:: cpp 

    RED::Object* red_file = RED::Factory::CreateInstance( CID_REDFile );

and get back its interface with:

.. code:: cpp 

    RED::IREDFile* ired_file = red_file->As< RED::IREDFile >();

The last thing to do is to get access to the file content:

.. rubric:: Case of File on Disk

.. code:: cpp 

    RC_TEST( ired_file->Create( "./my_file.red" ) );

.. rubric:: More Generic Case of a ``RED::IStream``

.. code:: cpp 

    // stream is a pointer to a RED stream.
    RC_TEST( ired_file->Create( stream ) );
