MCPcopy Create free account
hub / github.com/alibaba/async_simple / ReadFile

Function ReadFile

demo_example/CountChar.cpp:28–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26using Texts = std::vector<std::string>;
27
28Lazy<Texts> ReadFile(const std::string &filename) {
29 Texts Result;
30 std::ifstream infile(filename);
31 std::string line;
32 while (std::getline(infile, line))
33 Result.push_back(line);
34 co_return Result;
35}
36
37Lazy<int> CountLineChar(const std::string &line, char c) {
38 auto ret = std::count(line.begin(), line.end(), c);

Callers 1

CountFileCharNumFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected