---
title: readOnly
framework: system
role: symbol
role_heading: Type Property
path: system/filedescriptor/accessmode/readonly
---

# readOnly

Opens the file for reading only.

## Declaration

```swift
static var readOnly: FileDescriptor.AccessMode { get }
```

## Mentioned in

Adopting Swift File Options

## Discussion

Discussion The corresponding C constant is O_RDONLY.

## See Also

### Creating an Access Mode

- [readWrite](system/filedescriptor/accessmode/readwrite.md)
- [writeOnly](system/filedescriptor/accessmode/writeonly.md)
