writeFile overloads

Synopses

Declared in <folly/FileUtil.h>

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

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);

Writes container to file. The container is assumed to be contiguous, with element size equal to 1, and offering STL‐like methods empty(), size(), and indexed access (e.g. std::vector<char>, std::string, fbstring, StringPiece).

template<class Container>
bool
writeFile(
    Container const& data,
    char const* filename,
    int flags = O_WRONLY | O_CREAT | O_TRUNC,
    mode_t mode = 0666);

Return Value

True on success, false on failure.

Parameters

Name

Description

data

The container whose contents are written.

filename

Path of the file to write.

flags

open() flags controlling how the file is opened.

mode

Permission bits used when creating the file.

Created with MrDocs