<!--
{
  "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/read(into:retryOnInterrupt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System14FileDescriptorV4read4into16retryOnInterruptSiSw_SbtKF"
  },
  "title" : "read(into:retryOnInterrupt:)"
}
-->

# read(into:retryOnInterrupt:)

Reads bytes at the current file offset into a buffer.

```
func read(into buffer: UnsafeMutableRawBufferPointer, retryOnInterrupt: Bool = true) throws -> Int
```

## Parameters

`buffer`

The region of memory to read into.

`retryOnInterrupt`

Whether to retry the read 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

The number of bytes that were read.

## Discussion

The <doc://com.apple.documentation/documentation/Swift/UnsafeMutableRawBufferPointer/count> property of `buffer`
determines the maximum number of bytes that are read into that buffer.

After reading,
this method increments the file’s offset by the number of bytes read.
To change the file’s offset,
call the [`seek(offset:from:)`](/documentation/System/FileDescriptor/seek(offset:from:)) method.

The corresponding C function is `read`.

---

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)