MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / read_file

Function read_file

smallthinker/common/arg.cpp:48–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46};
47
48static std::string read_file(const std::string & fname) {
49 std::ifstream file(fname);
50 if (!file) {
51 throw std::runtime_error(string_format("error: failed to open file '%s'\n", fname.c_str()));
52 }
53 std::string content((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
54 file.close();
55 return content;
56}
57
58static void write_file(const std::string & fname, const std::string & content) {
59 std::ofstream file(fname);

Callers 2

common_get_hf_fileFunction · 0.70

Calls 3

string_formatFunction · 0.70
c_strMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected