void filesystem_utils::load(const std::string &path, std::string &buffer, uint32 open_mode /*= std::fstream::in | std::fstream::binary*/)
{
std::ifstream fs;
fs.open(path.c_str(), open_mode);
if (!fs.is_open())
{
return;
}
buffer.assign(std::istreambuf_iterator<char>(fs.rdbuf()), std::istreambuf_iterator<char>());
fs.close();
}
filesystem_utils::load("C:\\test.xml");
filesystem_utils::load is a static function
development tool: visual studio 2015 professional
std::ifstream reports an error in the destructor, it looks like this:
Exception thrown at 0x00007FF7F38E1C83 in Logic.exe: 0xC0000005: Access violation reading location 0x0000000000000004.
User contributions licensed under CC BY-SA 3.0