Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fstream.cpp
Go to the documentation of this file.
1#include <fstream>
2#include <sstream>
3
4#include <fc/filesystem.hpp>
6#include <fc/io/fstream.hpp>
7#include <fc/log/logger.hpp>
8
9#include <boost/filesystem/path.hpp>
10#include <boost/filesystem/fstream.hpp>
11
12namespace fc {
13
14 void read_file_contents( const fc::path& filename, std::string& result )
15 {
16 const boost::filesystem::path& bfp = filename;
17 boost::filesystem::ifstream f( bfp, std::ios::in | std::ios::binary );
18 FC_ASSERT(f, "Failed to open ${filename}", ("filename", filename));
19 // don't use fc::stringstream here as we need something with override for << rdbuf()
20 std::stringstream ss;
21 ss << f.rdbuf();
22 FC_ASSERT(f, "Failed reading ${filename}", ("filename", filename));
23 result = ss.str();
24 }
25
26} // namespace fc
wraps boost::filesystem::path to provide platform independent path manipulation.
Defines exception's used by fc.
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
namespace sysio::chain
Definition authority.cpp:3
void read_file_contents(const fc::path &filename, std::string &result)
Definition fstream.cpp:14