Bitcoin Core 28.99.0
P2P Digital Currency
|
#include <util/readwritefile.h>
#include <util/fs.h>
#include <algorithm>
#include <cstdio>
#include <limits>
#include <string>
#include <utility>
Go to the source code of this file.
Functions | |
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. More... | |
bool | WriteBinaryFile (const fs::path &filename, const std::string &data) |
Write contents of std::string to a file. More... | |
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.
Returns a pair <status, string>. If an error occurred, status will be false, otherwise status will be true and the data will be returned in string.
maxsize | Puts a maximum size limit on the file that is read. If the file is larger than this, truncated data (with len > maxsize) will be returned. |
Definition at line 16 of file readwritefile.cpp.
bool WriteBinaryFile | ( | const fs::path & | filename, |
const std::string & | data | ||
) |
Write contents of std::string to a file.
Definition at line 37 of file readwritefile.cpp.