charcoal/OpenGLEngine/Util.cpp

17 lines
426 B
C++
Raw Normal View History

2018-09-05 06:49:02 +00:00
#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.";
}