Navigation: Up, Table of Contents, Bibliography, Index, Title Page

Output Streams (ostream)

Definition

CGAL defines output operators for classes that are derived from the class ostream. This allows to write to ostreams as cout or cerr, as well as to strstreams and fstreams. Let os be an output stream.

Operations

The output operator is defined for all classes in the CGAL kernel and for the class CGAL_Color as well.

ostream& os << CGAL_Class c
Inserts object c in the stream.

Example


#include <iostream.h>
#include <fstream.h>

#include <CGAL/Cartesian.h>
#include <CGAL/Segment_2.h>

typedef CGAL_Point_2< CGAL_Cartesian<double> >     Point;
typedef CGAL_Segment_2< CGAL_Cartesian<double> >   Segment;

int main()
{
    Point p(0,1), q(2,2);
    Segment s(p,q);

    CGAL_set_pretty_mode(cout);
    cout << p << endl << q  << endl;

    ofstream f("data.txt");
    CGAL_set_binary_mode(f);
    f << s << p ;

    return 1;
}


Next: Class declaration of istream
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The CGAL Project. Wed, January 20, 1999.