---
title: "seek(toFileOffset:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/filehandle/seek(tofileoffset:)"
---

# seek(toFileOffset:)

Moves the file pointer to the specified offset within the file represented by the receiver.

## Declaration

```swift
func seek(toFileOffset offset: UInt64)
```

## Parameters

- `offset`: The offset to seek to.

## Mentioned in

About Apple File System

## Discussion

Discussion Raises fileHandleOperationException if called on a file handle representing a pipe or socket, if the file descriptor is closed, or if any other error occurs.

## See Also

### Deprecated

- [readDataToEndOfFile()](foundation/filehandle/readdatatoendoffile().md)
- [readData(ofLength:)](foundation/filehandle/readdata(oflength:).md)
- [write(_:)](foundation/filehandle/write(_:).md)
- [offsetInFile](foundation/filehandle/offsetinfile.md)
- [seekToEndOfFile()](foundation/filehandle/seektoendoffile().md)
- [closeFile()](foundation/filehandle/closefile().md)
- [synchronizeFile()](foundation/filehandle/synchronizefile().md)
- [truncateFile(atOffset:)](foundation/filehandle/truncatefile(atoffset:).md)
- [NSFileHandleNotificationMonitorModes](foundation/nsfilehandlenotificationmonitormodes.md)
