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

Function createTextFile

src/platforms/stub/fs_stub.hpp:246–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244 }
245
246 static bool createTextFile(const fl::string& path, const fl::string& content) FL_NOEXCEPT {
247 // Force remove any existing file first to ensure clean state
248 removeFile(path.c_str());
249
250 // Create new file with explicit truncate mode
251 fl::ofstream ofs(path.c_str(), fl::ios::binary | fl::ios::trunc) FL_NOEXCEPT;
252 if (!ofs.is_open()) {
253 return false;
254 }
255 ofs.write(content.data(), content.size()); // Use write() instead of << for exact byte control
256 bool success = ofs.good(); // Check status before close
257 ofs.close(); // Explicitly close to flush buffers before reading
258 return success;
259 }
260
261 bool begin() FL_NOEXCEPT override {
262 return true;

Callers 3

FL_TEST_FILEFunction · 0.85
FL_TEST_FILEFunction · 0.85
FL_TEST_FILEFunction · 0.85

Calls 8

removeFileFunction · 0.85
c_strMethod · 0.45
is_openMethod · 0.45
writeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
goodMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected