<!--
{
  "availability" : [
    "macOS: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSBlockDeviceResource/read(into:startingAt:length:)-4ax6s",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "s:So21FSBlockDeviceResourceC5FSKitE4read4into10startingAt6lengthSiSw_s5Int64VSitKF"
  },
  "title" : "read(into:startingAt:length:)"
}
-->

# read(into:startingAt:length:)

Synchronously reads data from the resource into a buffer.

```
func read(into buffer: UnsafeMutableRawBufferPointer, startingAt offset: off_t, length: Int) throws -> Int
```

## Parameters

`buffer`

A buffer to receive the data.

`offset`

The offset into the resource from which to start reading.

`length`

A maximum number of bytes to read. The method’s return value contains the actual number of bytes read.

## Return Value

The actual number of bytes read.

## Discussion

This is a synchronous version of [`read(into:startingAt:length:)`](/documentation/FSKit/FSBlockDeviceResource/read(into:startingAt:length:)-4ax6s).

In some cases, this method performs a partial read. In this case, the return value is shorter than the requested length.

> Throws: An error describing any read error. This value is `EFAULT` if `buffer` is `NULL`, or `errno` if reading from the resource failed.

---

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)