--- smsdaemon/util.cpp 2008/07/04 07:58:26 108 +++ smsdaemon/util.cpp 2008/12/07 00:59:05 132 @@ -10,7 +10,9 @@ #include #include #include +#include +#include #include "util.h" using namespace std; @@ -342,6 +344,29 @@ return (pclose(p)); } + string readfile(string filename) + { + string str; + ifstream in(filename.c_str()); + if (in) + { + char buffer[2048]; + in.read(buffer, 2047); + buffer[ in.gcount() ] = 0; + str = string(buffer); + in.close(); + } + else + { + string message = "Could no open "; + message += filename; + throw std::runtime_error(message); + } + return str; + } + + + }