17 lines
426 B
C++
17 lines
426 B
C++
|
#include "Util.h"
|
||
|
|
||
|
#include <fstream>
|
||
|
|
||
|
std::vector<char> Util::load_file(const std::string& path)
|
||
|
{
|
||
|
std::ifstream input_stream(path, std::ios::binary | std::ios::in | std::ios::ate);
|
||
|
if (input_stream)
|
||
|
{
|
||
|
std::streampos size = input_stream.tellg();
|
||
|
input_stream.seekg(std::ios::beg);
|
||
|
std::vector<char> buffer(size);
|
||
|
input_stream.read(buffer.data(), size);
|
||
|
input_stream.close();
|
||
|
}
|
||
|
throw "Unable to access file.";
|
||
|
}
|