MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / ReadFile

Function ReadFile

src/cpp/test/web-ifc-test.cpp:33–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33std::string ReadFile(std::string filename)
34{
35 std::ifstream file(filename, std::ios::binary);
36 if (!file) {
37 throw std::runtime_error("Could not open file");
38 }
39
40 file.seekg(0, std::ios::end);
41 std::streamsize size = file.tellg();
42 file.seekg(0, std::ios::beg);
43
44 std::string buffer(size, '\0');
45
46 if (!file.read(buffer.data(), size)) {
47 throw std::runtime_error("Error reading file");
48 }
49
50 return buffer;
51}
52
53void SpecificLoadTest(webifc::parsing::IfcLoader &loader, webifc::geometry::IfcGeometryProcessor &geometryLoader, uint64_t num)
54{

Callers 2

BenchmarkFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected