#include <iostream>
#include <fstream>
using namespace std;
void read_file(const std::string &path, std::string &out)
{
///std::ifstream fs(path.c_str(), std::ios_base::binary);
std::ifstream fs(path, std::ios_base::binary);
fs.seekg(0, std::ios_base::end);
auto size = fs.tellg();
fs.seekg(0);
out.resize(static_cast<size_t>(size));
fs.read(&out[0], size);
}
///g++ a.cpp -std=c++11
int main()
{
///绝对目录和当前目录都是支持的
///string path = "/home/ubuntu/IVSProjs/2021/3/aaa.txt";
string path = "aaa.txt";
string out;
read_file(path, out);
cout << out << endl;
return 0;
}