File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -162,5 +162,17 @@ std::vector<char> file_to_buffer(const std::string& fn)
162
162
return data;
163
163
}
164
164
165
+ // need a file to string method
166
+ std::string file_to_string (const std::string & fn)
167
+ {
168
+ ifstream file (fn);
169
+ if (!file)
170
+ return std::string ();
171
+ string data (
172
+ (istreambuf_iterator<char >(file)),
173
+ istreambuf_iterator<char >()
174
+ );
175
+ return data;
176
+ }
165
177
166
178
} // END OF NAMESPACE
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ namespace Filesystem
39
39
std::vector<std::string> extensions = std::vector<std::string>()
40
40
);
41
41
std::vector<char > file_to_buffer (const std::string& fn);
42
+ std::string file_to_string (const std::string& fn);
42
43
}
43
44
44
45
#endif
You can’t perform that action at this time.
0 commit comments