From 48cd2e4268af2b982c49f2d00b599abf8501cad2 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Fri, 9 Jan 2009 19:11:05 -0600 Subject: [PATCH] UnformattedRead throws NoSuchFileException now --- src/fortran.cpp | 9 +++++++-- src/fortran.hpp | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fortran.cpp b/src/fortran.cpp index eff37da..285d100 100644 --- a/src/fortran.cpp +++ b/src/fortran.cpp @@ -8,18 +8,23 @@ using namespace std; using namespace CosmoTool; UnformattedRead::UnformattedRead(const string& fname) - throw() + throw(NoSuchFileException) { f = new ifstream(fname.c_str()); + if (!*f) + throw NoSuchFileException(); + swapOrdering = false; cSize = Check_32bits; checkPointRef = checkPointAccum = 0; } UnformattedRead::UnformattedRead(const char *fname) - throw() + throw(NoSuchFileException) { f = new ifstream(fname); + if (!*f) + throw NoSuchFileException(); swapOrdering = false; cSize = Check_32bits; checkPointRef = checkPointAccum = 0; diff --git a/src/fortran.hpp b/src/fortran.hpp index 21751bc..361978e 100644 --- a/src/fortran.hpp +++ b/src/fortran.hpp @@ -25,9 +25,9 @@ namespace CosmoTool }; UnformattedRead(const std::string& fname) - throw (); + throw (NoSuchFileException); UnformattedRead(const char *fname) - throw (); + throw (NoSuchFileException); ~UnformattedRead(); // Todo implement primitive description