# fileSetPos (Shared)

> Changes a file's read and write position.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Files
- **URL**: https://wiki.mymp.gg/en/fileSetPos

## Syntax

```lua
int fileSetPos(file file, int offset)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `file` | `file` | A file opened by `fileOpen` or `fileCreate`. |
| `offset` | `int` | The position in bytes from the start, 0 or more. |

## Returns

The new position. A position past the end stays at the end.

## Example

```lua
fileSetPos(file, 0) -- back to the start
```

## See also

- [fileGetPos (Shared)](https://wiki.mymp.gg/en/fileGetPos.md): Returns a file's current read and write position.
- [fileRead (Shared)](https://wiki.mymp.gg/en/fileRead.md): Reads bytes from a file at the current position and moves the position on.
