#include <anna/core/util/Tokenizer.hpp>
#include <algorithm>
+#include <fstream>
+#include <sstream>
using namespace anna;
throw() {
struct tm* tt = localtime((time_t*) & second);
sprintf(
- result, "%02d/%02d/%4d %02d:%02d:%02d",
+ result, "%02u/%02u/%4u %02u:%02u:%02u",
tt->tm_mday, tt->tm_mon + 1, tt->tm_year + 1900,
tt->tm_hour, tt->tm_min, tt->tm_sec
);
return ret;
}
+bool functions::getContentFromFile(const std::string &pathfile, std::string &content) throw(anna::RuntimeException) {
+
+ std::ifstream inFile(pathfile.c_str(), std::ifstream::in);
+ if(!inFile.good()) {
+ throw RuntimeException(anna::functions::asString("Unable to open file '%s'", pathfile.c_str()), ANNA_FILE_LOCATION);
+ }
+
+ std::stringstream strStream;
+ strStream << inFile.rdbuf(); //read the file
+ content = strStream.str(); // holds the content of the file
+ inFile.close();
+
+ return true;
+}
+