J
Jason Heyes
I tried to use this function to read a binary file. It only reads a few
thousand bytes and not the entire file. How do I change it to read a whole
binary file? Thanks in advance.
bool read_file(const char *fname, std::string &data)
{
std::ifstream in(fname);
if (!in.is_open())
return false;
std::stringstream ss;
if (!(ss << in.rdbuf()))
return false;
data = ss.str();
return true;
}
thousand bytes and not the entire file. How do I change it to read a whole
binary file? Thanks in advance.
bool read_file(const char *fname, std::string &data)
{
std::ifstream in(fname);
if (!in.is_open())
return false;
std::stringstream ss;
if (!(ss << in.rdbuf()))
return false;
data = ss.str();
return true;
}