ΒΆstd::error_code openFile(
    const llvm::Twine& Name,
    int& ResultFD,
    llvm::sys::fs::CreationDisposition Disp,
    llvm::sys::fs::FileAccess Access,
    llvm::sys::fs::OpenFlags Flags,
    unsigned int Mode = 438)

Description

Opens a file with the specified creation disposition, access mode, and flags and returns a file descriptor.

The caller is responsible for closing the file descriptor once they are finished with it.

Declared at: llvm/include/llvm/Support/FileSystem.h:951

Parameters

const llvm::Twine& Name
The path of the file to open, relative or absolute.
int& ResultFD
If the file could be opened successfully, its descriptor is stored in this location. Otherwise, this is set to -1.
llvm::sys::fs::CreationDisposition Disp
Value specifying the existing-file behavior.
llvm::sys::fs::FileAccess Access
Value specifying whether to open the file in read, write, or read-write mode.
llvm::sys::fs::OpenFlags Flags
Additional flags.
unsigned int Mode = 438
The access permissions of the file, represented in octal.

Returns

errc::success if \a Name has been opened, otherwise a platform-specific error_code.