---
title: "read(into:retryOnInterrupt:)"
framework: system
role: symbol
role_heading: Instance Method
path: "system/filedescriptor/read(into:retryoninterrupt:)"
---

# read(into:retryOnInterrupt:)

Reads bytes at the current file offset into a buffer.

## Declaration

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

## Mentioned in

Adopting Swift File Operations

## Return Value

Return Value The number of bytes that were read.

## Discussion

Discussion The doc://com.apple.documentation/documentation/swift/unsafemutablerawbufferpointer/count-95usp 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:) method. The corresponding C function is read.

## See Also

### Reading From a File

- [read(fromAbsoluteOffset:into:retryOnInterrupt:)](system/filedescriptor/read(fromabsoluteoffset:into:retryoninterrupt:).md)
