<!--
{
  "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/seek(offset:from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System14FileDescriptorV4seek6offset4froms5Int64VAH_AC10SeekOriginVtKF"
  },
  "title" : "seek(offset:from:)"
}
-->

# seek(offset:from:)

Repositions the offset for the given file descriptor.

```
@discardableResult func seek(offset: Int64, from whence: FileDescriptor.SeekOrigin) throws -> Int64
```

## Parameters

`offset`

The new offset for the file descriptor.

`whence`

The origin of the new offset.

## Return Value

The file’s offset location,
in bytes from the beginning of the file.

## Discussion

The corresponding C function is `lseek`.

---

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)