MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / read_file

Function read_file

subprojects/llama.cpp/common/download.cpp:71–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71static std::string read_file(const std::string & fname) {
72 std::ifstream file(fname);
73 if (!file) {
74 throw std::runtime_error(string_format("error: failed to open file '%s'\n", fname.c_str()));
75 }
76 std::string content((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
77 file.close();
78 return content;
79}
80
81static void write_file(const std::string & fname, const std::string & content) {
82 const std::string fname_tmp = fname + ".tmp";

Callers 1

common_get_hf_fileFunction · 0.70

Calls 2

string_formatFunction · 0.70
closeMethod · 0.65

Tested by

no test coverage detected