10 #include <boost/filesystem/path.hpp> 11 #include <boost/filesystem/fstream.hpp> 18 boost::filesystem::ofstream
ofs;
22 boost::filesystem::ifstream
ifs;
29 :my( new
impl() ) { this->
open( file, m ); }
33 const boost::filesystem::path& bfp = file;
34 my->ofs.open( bfp, std::ios_base::out | std::ios_base::binary | m );
37 my->ofs.write(buf,len);
42 return writesome(buffer.get() + offset, len);
60 this->
open( file, m );
65 const boost::filesystem::path& bfp = file;
66 my->ifs.open( bfp, std::ios::binary );
70 auto s = size_t(my->ifs.readsome( buf, len ));
77 s += size_t(my->ifs.readsome( &buf[1], len - 1));
84 return readsome(buffer.get() + offset, max);
90 my->ifs.read(buf,len);
91 if (my->ifs.gcount() < int64_t(len))
97 case beg: my->ifs.seekg( p, std::ios_base::beg );
return *
this;
98 case cur: my->ifs.seekg( p, std::ios_base::cur );
return *
this;
99 case end: my->ifs.seekg( p, std::ios_base::end );
return *
this;
109 const boost::filesystem::path& bfp = filename;
110 boost::filesystem::ifstream f( bfp, std::ios::in | std::ios::binary );
112 std::stringstream ss;
void open(const fc::path &file, int m)
size_t writesome(const char *buf, size_t len)
void read_file_contents(const fc::path &filename, std::string &result)
ifstream & seekg(size_t p, seekdir d=beg)
boost::filesystem::ofstream ofs
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
Defines exception's used by fc.
void open(const fc::path &file, std::ios_base::openmode m=std::ios_base::out|std::ios_base::binary)
size_t readsome(char *buf, size_t len)
boost::filesystem::ifstream ifs
ifstream & read(char *buf, size_t len)
wraps boost::filesystem::path to provide platform independent path manipulation.