MCPcopy Create free account
hub / github.com/arangodb/velocypack / tryReadFile

Function tryReadFile

tools/bench.cpp:57–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57static std::string tryReadFile(std::string const& filename) {
58 std::string s;
59 std::ifstream ifs(filename.c_str(), std::ifstream::in);
60
61 if (!ifs.is_open()) {
62 std::cerr << "Cannot open input file '" << filename << "'" << std::endl;
63 ::exit(EXIT_FAILURE);
64 }
65
66 char buffer[4096];
67 while (ifs.good()) {
68 ifs.read(&buffer[0], sizeof(buffer));
69 s.append(buffer, ifs.gcount());
70 }
71 ifs.close();
72
73 return s;
74}
75
76static std::string readFile(std::string filename) {
77#ifdef _WIN32

Callers 1

readFileFunction · 0.70

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected