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
>
5
#include <
fc/exception/exception.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
12
namespace
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
f
foo f
Definition
X02-DisabledMacros.cpp:25
fc::path
wraps boost::filesystem::path to provide platform independent path manipulation.
Definition
filesystem.hpp:28
exception.hpp
Defines exception's used by fc.
FC_ASSERT
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition
exception.hpp:362
filesystem.hpp
fstream.hpp
logger.hpp
fc
namespace sysio::chain
Definition
authority.cpp:3
fc::read_file_contents
void read_file_contents(const fc::path &filename, std::string &result)
Definition
fstream.cpp:14
libraries
fc
src
io
fstream.cpp
Generated by
1.12.0