lugre_utils.cpp

Go to the documentation of this file.
00001 #include "lugre_prefix.h"
00002 #include "lugre_utils.h"
00003 #include "lugre_profile.h"
00004 
00005 #include <iostream>
00006 #include <fstream>
00007 #include <sstream>
00008 #include <string>
00009 #include <stdexcept>
00010 
00011 using namespace Lugre;
00012 
00013 namespace Lugre {
00014 
00015 std::string GetFileContent(const std::string &filename){ PROFILE
00016     std::ifstream myfile(filename.c_str());
00017     
00018     if (myfile.is_open()){
00019         std::string line;
00020         std::stringstream out;
00021         
00022         while (! myfile.eof() ){
00023             getline (myfile,line);
00024             out << line;
00025         }
00026         
00027         myfile.close();
00028         
00029         return out.str();
00030     }
00031     
00032     throw std::runtime_error(std::string("could not read file: ") + filename);
00033 }
00034 
00035 }

Generated on Wed May 23 06:00:15 2012 for cpp by  doxygen 1.5.6