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 Color as well.
ostream&
|
os << Class c
|
Inserts object c in 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(0,1), q(2,2);
Segment s(p,q);
CGAL::set_pretty_mode(std::cout);
std::cout << p << std::endl << q << std::endl;
std::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 GALIA project. Jan 18, 2000.