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

Function tryReadFile

tests/testsFiles.cpp:33–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include "tests-common.h"
32
33static std::string tryReadFile(std::string const& filename) {
34 std::string s;
35 std::ifstream ifs(filename.c_str(), std::ifstream::in);
36
37 if (!ifs.is_open()) {
38 throw "cannot open input file";
39 }
40
41 char buffer[4096];
42 while (ifs.good()) {
43 ifs.read(&buffer[0], sizeof(buffer));
44 s.append(buffer, ifs.gcount());
45 }
46 ifs.close();
47
48 return s;
49}
50
51static std::string readFile(std::string filename) {
52#ifdef _WIN32

Callers 1

readFileFunction · 0.70

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected