MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / ReadFileToString

Function ReadFileToString

Bcore/src/main/cpp/android-base/file.cpp:70–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70bool ReadFileToString(const std::string& path, std::string* content, bool follow_symlinks) {
71 content->clear();
72
73 int flags = O_RDONLY | O_CLOEXEC | O_BINARY | (follow_symlinks ? 0 : O_NOFOLLOW);
74 android_lkchan::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags)));
75 if (fd == -1) {
76 return false;
77 }
78 return ReadFdToString(fd, content);
79}
80
81bool WriteStringToFd(const std::string& content, int fd) {
82 const char* p = content.data();

Callers

nothing calls this directly

Calls 3

ReadFdToStringFunction · 0.85
c_strMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected