---
title: "open(_:_:options:permissions:retryOnInterrupt:)"
framework: system
role: symbol
role_heading: Type Method
path: "system/filedescriptor/open(_:_:options:permissions:retryoninterrupt:)-4ql4b"
---

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

Opens or creates a file for reading or writing.

## Declaration

```swift
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 doc://com.apple.SwiftSystem/documentation/System/Errno/interrupted. The default is true. Pass false to try only once and throw an error upon interruption.

## Return Value

Return Value A file descriptor for the open file

## Discussion

Discussion The corresponding C function is open.

## See Also

### Opening a File

- [open(_:_:options:permissions:retryOnInterrupt:)](system/filedescriptor/open(_:_:options:permissions:retryoninterrupt:)-5t3xn.md)
- [FileDescriptor.AccessMode](system/filedescriptor/accessmode.md)
- [FileDescriptor.OpenOptions](system/filedescriptor/openoptions.md)
