<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "System",
  "identifier" : "/documentation/System/FileDescriptor/writeAll(toAbsoluteOffset:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System14FileDescriptorV8writeAll16toAbsoluteOffset_Sis5Int64V_xtKSTRzs5UInt8V7ElementRtzlF"
  },
  "title" : "writeAll(toAbsoluteOffset:_:)"
}
-->

# writeAll(toAbsoluteOffset:_:)

Writes a sequence of bytes to the given offset.

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

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

## Discussion

This method either writes the entire contents of `sequence`,
or throws an error if only part of the content was written.
Unlike [`writeAll(_:)`](/documentation/System/FileDescriptor/writeAll(_:)),
this method preserves the file descriptor’s existing offset.

If `sequence` doesn’t implement
the <doc://com.apple.documentation/documentation/Swift/Sequence/withContiguousStorageIfAvailable(_:)> method,
temporary space will be allocated as needed.

---

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)