---
title: "read(into:startingAt:length:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsblockdeviceresource/read(into:startingat:length:)-4ax6s"
---

# read(into:startingAt:length:)

Synchronously reads data from the resource into a buffer.

## Declaration

```swift
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

Return Value The actual number of bytes read.

## Discussion

Discussion This is a synchronous version of read(into:startingAt:length:). In some cases, this method performs a partial read. In this case, the return value is shorter than the requested length. note: An error describing any read error. This value is EFAULT if buffer is NULL, or errno if reading from the resource failed.

## See Also

### Reading and writing data

- [read(into:startingAt:length:)](fskit/fsblockdeviceresource/read(into:startingat:length:)-5yozi.md)
- [read(into:startingAt:length:completionHandler:)](fskit/fsblockdeviceresource/read(into:startingat:length:completionhandler:).md)
- [write(from:startingAt:length:)](fskit/fsblockdeviceresource/write(from:startingat:length:)-2fmgt.md)
- [write(from:startingAt:length:)](fskit/fsblockdeviceresource/write(from:startingat:length:)-9oa1x.md)
- [write(from:startingAt:length:completionHandler:)](fskit/fsblockdeviceresource/write(from:startingat:length:completionhandler:).md)
