folly::writeFile

Same as above, but takes a std::filesystem::path instead of filename

Synopsis

Declared in <folly/FileUtil.h>

template<class Container>
requires (std::same_as<std::filesystem::path::value_type, char>)
bool
writeFile(
    Container const& data,
    std::filesystem::path const& filename,
    int flags = O_WRONLY | O_CREAT | O_TRUNC,
    mode_t mode = 0666);

Return Value

True on success, false on failure.

Parameters

NameDescription
dataThe container whose contents are written.
filenamePath of the file to write.
flagsopen() flags controlling how the file is opened.
modePermission bits used when creating the file.