---
title: offset()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/filehandle/offset()
---

# offset()

Gets the position of the file pointer within the file.

## Declaration

```swift
func offset() throws -> UInt64
```

## Return Value

Return Value The position of the file pointer within the file.

## Discussion

Discussion Throws an error if called on a file handle representing a pipe or socket, or if the file descriptor is closed.

## See Also

### Seeking within a file

- [seekToEnd()](foundation/filehandle/seektoend().md)
- [seek(toOffset:)](foundation/filehandle/seek(tooffset:).md)
