Contents

open(_:_:options:permissions:retryOnInterrupt:)

Opens or creates a file for reading or writing.

Declaration

static func open(_ path: FilePath, _ mode: FileDescriptor.AccessMode, options: FileDescriptor.OpenOptions = FileDescriptor.OpenOptions(), permissions: FilePermissions? = nil, retryOnInterrupt: Bool = true) throws -> FileDescriptor

Parameters

  • path:

    The location of the file to open.

  • mode:

    The read and write access to use.

  • options:

    The behavior for opening the file.

  • permissions:

    The file permissions to use for created files.

  • retryOnInterrupt:

    Whether to retry the open operation if it throws Interrupted. The default is true. Pass false to try only once and throw an error upon interruption.

Return Value

A file descriptor for the open file

Discussion

The corresponding C function is open.

See Also

Opening a File