MCPcopy Create free account
hub / github.com/dobin/RedEdr / read_file

Function read_file

RedEdrShared/utils.cpp:173–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171
172
173std::string read_file(const std::string& path) {
174 std::ifstream file(path);
175 if (!file.is_open()) {
176 std::cerr << "Could not open file: " << path << std::endl;
177 return "";
178 }
179 std::stringstream buffer;
180 buffer << file.rdbuf(); // Read the file into the stringstream
181 return buffer.str();
182}
183
184
185void write_file(std::string path, std::string data) {

Callers

nothing calls this directly

Calls 2

strMethod · 0.80
is_openMethod · 0.45

Tested by

no test coverage detected