13std::pair<bool,std::string>
ReadBinaryFile(
const fs::path &filename,
size_t maxsize=std::numeric_limits<size_t>::max())
17 return std::make_pair(
false,
"");
21 const size_t n = fread(buffer, 1,
sizeof(buffer), f);
26 return std::make_pair(
false,
"");
28 retval.append(buffer, buffer+n);
29 }
while (!feof(f) && retval.size() <= maxsize);
31 return std::make_pair(
true,retval);
39 if (fwrite(data.data(), 1, data.size(), f) != data.size()) {
Path class wrapper to prepare application code for transition from boost::filesystem library to std::...
FILE * fopen(const fs::path &p, const char *mode)
bool WriteBinaryFile(const fs::path &filename, const std::string &data)
Write contents of std::string to a file.
std::pair< bool, std::string > ReadBinaryFile(const fs::path &filename, size_t maxsize=std::numeric_limits< size_t >::max())
Read full contents of a file and return them in a std::string.