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

Input Streams (istream)

Definition

CGAL defines input operators for classes that are derived from the class istream. This allows to read from istreams as cin, as well as from strstreams and fstreams. Let is be an input stream.

Operations

The input operator is defined for all classes in the CGAL kernel.

istream& is >> CGAL_Class c Extracts object c from 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, q;
    Segment s;

    CGAL_set_ascii_mode(cin);
    cout >> p >> q;

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

    return 1;
}


Return to chapter: Operators for IO streams
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The CGAL Project. Wed, January 20, 1999.