MCPcopy Create free account
hub / github.com/arvidn/libtorrent / load_file

Function load_file

examples/client_test.cpp:242–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242bool load_file(std::string const& filename, std::vector<char>& v
243 , int limit = 8000000)
244{
245 std::fstream f(filename, std::ios_base::in | std::ios_base::binary);
246 f.seekg(0, std::ios_base::end);
247 auto const s = f.tellg();
248 if (s > limit || s < 0) return false;
249 f.seekg(0, std::ios_base::beg);
250 v.resize(static_cast<std::size_t>(s));
251 if (s == std::fstream::pos_type(0)) return !f.fail();
252 f.read(v.data(), int(v.size()));
253 return !f.fail();
254}
255
256bool is_absolute_path(std::string const& f)
257{

Callers 3

add_magnetFunction · 0.70
add_torrentFunction · 0.70
mainFunction · 0.70

Calls 5

resizeMethod · 0.45
failMethod · 0.45
readMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected