20 return std::make_pair(
false,
"");
24 const size_t n = fread(buffer, 1, std::min(
sizeof(buffer), maxsize - retval.size()), f);
29 return std::make_pair(
false,
"");
31 retval.append(buffer, buffer+n);
32 }
while (!feof(f) && retval.size() < maxsize);
34 return std::make_pair(
true,retval);
42 if (fwrite(
data.data(), 1,
data.size(), f) !=
data.size()) {
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
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)
Read full contents of a file and return them in a std::string.