Hi,
I’m doing a plugin that needs to charge a .obj or another 3d object file and this is the function with which I can read files but I don’t know why “ifstream” doesn’t work. I’m working with OpenGL.
// Reads a text file and outputs a string with everything in the text file
std::string get_file_contents(const char* filename)
{
std::ifstream in(filename, std::ios::binary);
if (in)
{
std::string contents;
in.seekg(0, std::ios::end);
contents.resize(in.tellg());
in.seekg(0, std::ios::beg);
in.read(&contents[0], contents.size());
in.close();
return(contents);
}
throw(errno);
}