<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "System",
  "identifier" : "/documentation/System/FileDescriptor/open(_:_:options:permissions:retryOnInterrupt:)-5t3xn",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System14FileDescriptorV4open__7options11permissions16retryOnInterruptACSPys4Int8VG_AC10AccessModeVAC11OpenOptionsVAA0B11PermissionsVSgSbtKFZ"
  },
  "title" : "open(_:_:options:permissions:retryOnInterrupt:)"
}
-->

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

Opens or creates a file for reading or writing.

```
static func open(_ path: UnsafePointer<CChar>, _ 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`](/documentation/System/Errno/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`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)