<1>
#include<iostream>
#include <fstream>
std::ifstream in("filepath");
std::istreambuf_iterator<char> beg(in), end;
std::string str(beg, end);
<2>
#include<iostream>
#include <fstream>
#include <sstream>
std::ifstream in("filepath");
std::ostringstream oss;
oss<< in.rdbuf();
std::string str = tmp.str();