MCPcopy Create free account
hub / github.com/FastLED/FastLED / readText

Method readText

src/fl/system/file_system.cpp.hpp:180–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180bool FileSystem::readText(const char *path, fl::string *out) {
181 fl::ifstream file = openRead(path);
182 if (!file.is_open()) {
183 FL_WARN("Failed to open file: " << path);
184 return false;
185 }
186 fl::size size = file.size();
187 out->reserve(size + out->size());
188 bool wrote = false;
189 while (file.available()) {
190 u8 buf[64];
191 fl::size n = file.read(buf, sizeof(buf));
192 out->append((const char *)buf, n);
193 wrote = true;
194 }
195 file.close();
196 FL_DBG_IF(!wrote, "Failed to write any data to the output string.");
197 return wrote;
198}
199
200} // namespace fl
201

Callers 1

FL_TEST_FILEFunction · 0.80

Calls 7

is_openMethod · 0.45
sizeMethod · 0.45
reserveMethod · 0.45
availableMethod · 0.45
readMethod · 0.45
appendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected