Create and open a new file with a name constructed by appending an automatically‐generated suffix to the specified prefix, and return its file descriptor open for reading and writing. A return value of k_INVALID_FD indicates that no such file could be created; otherwise, the name of the file created is assigned to the specified outPath. The file is created with permissions restricted, as closely as possible, to the caller`s userid only. If the prefix is a relative path, the file is created relative to the process current directory. Responsibility for deleting the file is left to the caller. Note that on Posix systems, if outPath is unlinked immediately, the file will remain usable until its descriptor is closed. Note that files created on Microsoft Windows may receive default, not restricted permissions.

Synopsis

Declared in <bdls_filesystemutil.h>

static
FileDescriptor
createTemporaryFile(
    bsl::string* outPath,
    std::string_view const& prefix);

Created with MrDocs