# fileWrite (Shared)

> Writes one or more texts to a file, at the current position.

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

## Syntax

```lua
int|false fileWrite(file file, string ...)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `file` | `file` | A file opened by `fileOpen` or `fileCreate`. |
| `...` | `string` | The texts, written one after another. |

## Returns

How many bytes were written, or `false` if the file was opened read-only, is sealed server content or the write failed.

## Example

```lua
local file = fileCreate("scores.csv")
fileWrite(file, "name,score\n", "carl,350\n")
fileClose(file)
```

## See also

- [fileRead (Shared)](https://wiki.mymp.gg/en/fileRead.md): Reads bytes from a file at the current position and moves the position on.
- [fileFlush (Shared)](https://wiki.mymp.gg/en/fileFlush.md): Writes to disk what was written to the file and is still in memory.
- [fileCreate (Shared)](https://wiki.mymp.gg/en/fileCreate.md): Creates an empty file and opens it for reading and writing. A file that already exists is wiped and made again; missing folders are created.
