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

# writeFrom:startingAt:length:error:

Synchronously writes data from from a buffer to the resource and executes a block afterwards.

## Declaration

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

## Parameters

- `buffer`: A buffer to provide the data.
- `offset`: The offset into the resource from which to start writing.
- `length`: A maximum number of bytes to write. The completion handler receives a parameter with the actual number of bytes write.
- `error`: On return, any error encountered while writing data, or nil if no error occurred.

## Return Value

Return Value The actual number of bytes written.

## Discussion

Discussion This is a synchronous version of writeFrom:startingAt:length:completionHandler:. note: In some cases, this method performs a partial write. 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:error:](fskit/fsblockdeviceresource/readinto:startingat:length:error:.md)
- [readInto:startingAt:length:completionHandler:](fskit/fsblockdeviceresource/readinto:startingat:length:completionhandler:.md)
- [writeFrom:startingAt:length:completionHandler:](fskit/fsblockdeviceresource/writefrom:startingat:length:completionhandler:.md)
