---
title: "readInto:startingAt:length:error:"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsblockdeviceresource/readinto:startingat:length:error:"
---

# readInto:startingAt:length:error:

Synchronously reads data from the resource into a buffer.

## Declaration

```occ
- (size_t) readInto:(void *) buffer startingAt:(off_t) offset length:(size_t) length error:(NSError **) error;
```

## 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.
- `error`: On return, any error encountered while reading data, or nil if no error occurred.

## Return Value

Return Value The actual number of bytes read.

## Discussion

Discussion This is a synchronous version of readInto:startingAt:length:completionHandler:. note: In some cases, this method performs a partial read. In this case, the return value is shorter than the requested length, and the error is set to nil.

## See Also

### Reading and writing data

- [readInto:startingAt:length:completionHandler:](fskit/fsblockdeviceresource/readinto:startingat:length:completionhandler:.md)
- [writeFrom:startingAt:length:error:](fskit/fsblockdeviceresource/writefrom:startingat:length:error:.md)
- [writeFrom:startingAt:length:completionHandler:](fskit/fsblockdeviceresource/writefrom:startingat:length:completionhandler:.md)
