---
name: "loadFile"
type: command
status: ok
groups: ["Program Flow"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/loadFile
revid: 352208
updated: 2024-02-01T23:26:04Z
---

# loadFile

*Command · Program Flow · Arma 3 v0.50 · introduced in Operation Flashpoint v1.90*

## Description

Returns the content of given files. If you plan to [compile](../commands/compile.md) said string, be aware that the file should not contain comments or [compile](../commands/compile.md) will throw an error. If there are comments, use [preprocessFile](../commands/preprocessFile.md)/[preprocessFileLineNumbers](../commands/preprocessFileLineNumbers.md) instead.

> [!WARNING]
> If the file is not prepared using UTF-8 encoding and contains some characters [with codes](../commands/toArray.md) > 127, they might convert incorrectly.

## Syntax

```sqf
loadFile fileName
```

**Parameters:**

- `fileName`: [String](../topics/String.md)

**Returns:** [String](../topics/String.md)

## Examples

### Example 1

```sqf
_contents = loadFile "wantedString.txt";
```

### Example 2

```sqf
_contents = compile loadFile "myFunction.sqf"; // will compile string into code
```

## See also

[fileExists](../commands/fileExists.md) · [preprocessFile](../commands/preprocessFile.md) · [preprocessFileLineNumbers](../commands/preprocessFileLineNumbers.md)

<sub>Source: [BI Community Wiki — loadFile](https://community.bistudio.com/wiki/loadFile) (revision 352208).</sub>
