Bitcoin ABC 0.30.5
P2P Digital Currency
Functions
readwritefile.h File Reference
#include <util/fs.h>
#include <limits>
#include <string>
#include <utility>
Include dependency graph for readwritefile.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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. More...
 
bool WriteBinaryFile (const fs::path &filename, const std::string &data)
 Write contents of std::string to a file. More...
 

Function Documentation

◆ ReadBinaryFile()

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.

Parameters
maxsizePuts 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 14 of file readwritefile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteBinaryFile()

bool WriteBinaryFile ( const fs::path filename,
const std::string &  data 
)

Write contents of std::string to a file.

Returns
true on success.

Definition at line 36 of file readwritefile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: