1.1 --- a/lemon/graph_to_eps.h Wed Oct 01 12:44:16 2008 +0200
1.2 +++ b/lemon/graph_to_eps.h Wed Oct 01 13:56:40 2008 +0200
1.3 @@ -40,6 +40,7 @@
1.4 #include<lemon/maps.h>
1.5 #include<lemon/color.h>
1.6 #include<lemon/bits/bezier.h>
1.7 +#include<lemon/error.h>
1.8
1.9
1.10 ///\ingroup eps_io
1.11 @@ -1166,8 +1167,13 @@
1.12 GraphToEps<DefaultGraphToEpsTraits<G> >
1.13 graphToEps(G &g,const char *file_name)
1.14 {
1.15 + std::ostream* os = new std::ofstream(file_name);
1.16 + if (!(*os)) {
1.17 + delete os;
1.18 + throw IoError("Cannot write file", file_name);
1.19 + }
1.20 return GraphToEps<DefaultGraphToEpsTraits<G> >
1.21 - (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name),true));
1.22 + (DefaultGraphToEpsTraits<G>(g,*os,true));
1.23 }
1.24
1.25 ///Generates an EPS file from a graph
1.26 @@ -1182,8 +1188,13 @@
1.27 GraphToEps<DefaultGraphToEpsTraits<G> >
1.28 graphToEps(G &g,const std::string& file_name)
1.29 {
1.30 + std::ostream* os = new std::ofstream(file_name.c_str());
1.31 + if (!(*os)) {
1.32 + delete os;
1.33 + throw IoError("Cannot write file", file_name);
1.34 + }
1.35 return GraphToEps<DefaultGraphToEpsTraits<G> >
1.36 - (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name.c_str()),true));
1.37 + (DefaultGraphToEpsTraits<G>(g,*os,true));
1.38 }
1.39
1.40 } //END OF NAMESPACE LEMON