---
title: "writeAll(toAbsoluteOffset:_:)"
framework: system
role: symbol
role_heading: Instance Method
path: "system/filedescriptor/writeall(toabsoluteoffset:_:)"
---

# writeAll(toAbsoluteOffset:_:)

Writes a sequence of bytes to the given offset.

## Declaration

```swift
@discardableResult func writeAll<S>(toAbsoluteOffset offset: Int64, _ sequence: S) throws -> Int where S : Sequence, S.Element == UInt8
```

## Parameters

- `offset`: The file offset where writing begins.
- `sequence`: The bytes to write.

## Return Value

Return Value The number of bytes written, equal to the number of elements in sequence.

## Discussion

Discussion This method either writes the entire contents of sequence, or throws an error if only part of the content was written. Unlike writeAll(_:), this method preserves the file descriptor’s existing offset. If sequence doesn’t implement the withContiguousStorageIfAvailable(_:) method, temporary space will be allocated as needed.

## See Also

### Writing To A File

- [write(_:retryOnInterrupt:)](system/filedescriptor/write(_:retryoninterrupt:).md)
- [write(toAbsoluteOffset:_:retryOnInterrupt:)](system/filedescriptor/write(toabsoluteoffset:_:retryoninterrupt:).md)
- [writeAll(_:)](system/filedescriptor/writeall(_:).md)
