Subject: CGAL users discussion list
List archive
- From: Laurent Rineau <>
- To:
- Subject: Re: [cgal-discuss] failed to read an OFF file
- Date: Thu, 11 Sep 2008 10:21:25 +0200
On Wednesday 10 September 2008 23:40:28 Qianqian Fang wrote:
> hi
>
> I used the examples at
> Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp to
> simplify a surface mesh. The mesh was saved as an OFF file, and feed to the
> program
> by the following lines:
>
> Surface surface;
> std::ifstream is(argv[1]) ; is >> surface ;
Just after that line, you can do:
if(!is) {
std::cerr << "OFF reading failed.\n";
}
The test "if(!is)" is equivalent, if i remember well, to "if(is.bad())": that
checks the state of the input stream. Wherever a operator>> fails to do its
job, it has to set the bad bit of the stream.
If you want a verbose message about the failure, you can use:
#include <CGAL/IO/Polyhedron_iostream.h>
CGAL::scan_OFF(in, surface, true); // true means "verbose=true"
--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/
- [cgal-discuss] failed to read an OFF file, Qianqian Fang, 09/10/2008
- Re: [cgal-discuss] failed to read an OFF file, Laurent Rineau, 09/11/2008
Archive powered by MHonArc 2.6.16.