Fix printed string showed when file opening fails

This commit is contained in:
Tiago Gomes 2013-02-13 19:18:55 +00:00
parent ab7f4c8113
commit 57f46e7c0d
5 changed files with 9 additions and 0 deletions

View File

@ -81,6 +81,7 @@ BayesBallGraph::exportToGraphViz (const char* fileName)
std::ofstream out (fileName);
if (!out.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
return;
}
out << "digraph {" << std::endl;

View File

@ -538,6 +538,7 @@ ConstraintTree::exportToGraphViz (
std::ofstream out (fileName);
if (!out.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
return;
}
out << "digraph {" << std::endl;

View File

@ -99,6 +99,7 @@ ElimGraph::exportToGraphViz (
std::ofstream out (fileName);
if (!out.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
return;
}
out << "strict graph {" << std::endl;

View File

@ -54,6 +54,7 @@ FactorGraph::readFromUaiFormat (const char* fileName)
std::ifstream is (fileName);
if (!is.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
exit (EXIT_FAILURE);
}
ignoreLines (is);
@ -139,6 +140,7 @@ FactorGraph::readFromLibDaiFormat (const char* fileName)
std::ifstream is (fileName);
if (!is.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
exit (EXIT_FAILURE);
}
ignoreLines (is);
@ -300,6 +302,7 @@ FactorGraph::exportToLibDai (const char* fileName) const
std::ofstream out (fileName);
if (!out.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
return;
}
out << facNodes_.size() << std::endl << std::endl;
@ -331,6 +334,7 @@ FactorGraph::exportToUai (const char* fileName) const
std::ofstream out (fileName);
if (!out.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
return;
}
out << (bayesFactors_ ? "BAYES" : "MARKOV") ;
@ -377,6 +381,7 @@ FactorGraph::exportToGraphViz (const char* fileName) const
std::ofstream out (fileName);
if (!out.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
return;
}
out << "graph \"" << fileName << "\" {" << std::endl;

View File

@ -285,6 +285,7 @@ LiftedCircuit::exportToGraphViz (const char* fileName)
std::ofstream out (fileName);
if (!out.is_open()) {
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << std::endl;
return;
}
out << "digraph {" << std::endl;