diff -r 47fbc814aa31 -r cbe3ec2d59d2 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Wed Oct 01 12:44:16 2008 +0200 +++ b/lemon/graph_to_eps.h Wed Oct 01 13:56:40 2008 +0200 @@ -40,6 +40,7 @@ #include #include #include +#include ///\ingroup eps_io @@ -1166,8 +1167,13 @@ GraphToEps > graphToEps(G &g,const char *file_name) { + std::ostream* os = new std::ofstream(file_name); + if (!(*os)) { + delete os; + throw IoError("Cannot write file", file_name); + } return GraphToEps > - (DefaultGraphToEpsTraits(g,*new std::ofstream(file_name),true)); + (DefaultGraphToEpsTraits(g,*os,true)); } ///Generates an EPS file from a graph @@ -1182,8 +1188,13 @@ GraphToEps > graphToEps(G &g,const std::string& file_name) { + std::ostream* os = new std::ofstream(file_name.c_str()); + if (!(*os)) { + delete os; + throw IoError("Cannot write file", file_name); + } return GraphToEps > - (DefaultGraphToEpsTraits(g,*new std::ofstream(file_name.c_str()),true)); + (DefaultGraphToEpsTraits(g,*os,true)); } } //END OF NAMESPACE LEMON