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 >> Class c Extracts object c from the stream.

Example


#include <CGAL/config.h>
#include <iostream>
#include <fstream>

#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(std::cin);
    std::cin >> p >> q;

    std::ifstream f("data.txt");
    CGAL::set_binary_mode(f);
    f >> s >> p;

    return 1;
}

Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The GALIA project. Jan 18, 2000.