--- trunk/OOPSE-4/src/utils/ElementsTable.cpp 2008/01/23 03:45:33 3319 +++ trunk/OOPSE-4/src/utils/ElementsTable.cpp 2008/09/14 01:32:26 3450 @@ -29,11 +29,15 @@ GNU General Public License for more details. * @version 1.0 */ +#include #include "config.h" +#include #include #include +#include #include "utils/ElementsTable.hpp" #include "utils/simError.h" +#include "io/basic_ifstrstream.hpp" #if !HAVE_STRNCASECMP extern "C" int strncasecmp(const char *s1, const char *s2, size_t n); @@ -95,6 +99,7 @@ namespace oopse { elNeg, ionize, elAffin, red, green, blue, name); elements_.push_back(ele); + } } @@ -284,7 +289,7 @@ namespace oopse { init_ = true; std::string buffer, subbuffer; - std::ifstream ifs1, ifs2, ifs3, ifs4, *ifsP; + ifstrstream ifs1, ifs2, ifs3, ifs4, *ifsP; // First, look for an environment variable if (getenv(envvar_.c_str()) != NULL) { buffer = getenv(envvar_.c_str()); @@ -317,23 +322,23 @@ namespace oopse { if ((*ifsP)) { while(ifsP->getline(charBuffer,BUFF_SIZE)) ParseLine(charBuffer); - - if (ifs1) - ifs1.close(); - if (ifs2) - ifs2.close(); - if (ifs3) - ifs3.close(); - if (ifs4) - ifs4.close(); - - if (GetSize() == 0) { - sprintf( painCave.errMsg, - "ElementsTable error.\n" - "\tCannot initialize database %s \n", filename_.c_str()); - painCave.isFatal = 0; - simError(); - } + + if (ifs1) + ifs1.close(); + if (ifs2) + ifs2.close(); + if (ifs3) + ifs3.close(); + if (ifs4) + ifs4.close(); + + if (GetSize() == 0) { + sprintf( painCave.errMsg, + "ElementsTable error.\n" + "\tCannot initialize database %s \n", filename_.c_str()); + painCave.isFatal = 0; + simError(); + } }