MCPcopy Create free account
hub / github.com/Dobiasd/FunctionalPlus / write_binary_file

Function write_binary_file

include/fplus/side_effects.hpp:476–485  ·  view source on GitHub ↗

API search type: write_binary_file : (String, [Int]) -> Io Bool Returns a function that (when called) writes content into a binary file, replacing it if it already exists.

Source from the content-addressed store, hash-verified

474// Returns a function that (when called) writes content into a binary file,
475// replacing it if it already exists.
476inline std::function<bool()> write_binary_file(const std::string& filename,
477 const std::vector<uint8_t>& content)
478{
479 return [filename, content]() -> bool {
480 std::ofstream file(filename, std::ios::binary);
481 file.write(reinterpret_cast<const char*>(&content[0]),
482 static_cast<std::streamsize>(content.size()));
483 return file.good();
484 };
485}
486
487// API search type: write_text_file_lines : (String, [String], Bool) -> Io Bool
488// Returns a function that (when called) writes lines into a text file,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected