---
name: "preprocessFileLineNumbers"
type: command
status: ok
groups: ["System"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/preprocessFileLineNumbers
revid: 364516
updated: 2024-05-16T20:46:22Z
---

# preprocessFileLineNumbers

*Command · System · Arma 3 v0.50 · introduced in Operation Flashpoint: Elite v1.00*

## Description

Returns the preprocessed content of the given file. The preprocessor is C-like, it supports comments using /* */ and [PreProcessor Commands](../topics/PreProcessor_Commands.md). The preprocessor also adds a default debug entrypoint for compiler at the begining of script: `1. line 1 "aFilename"`

The **#line** keyword can be used in any script that are not preprocess, or with preprocess script with extra macro to protect reserverd sharp character. The format is:

`**#line** <number> "<name>"`

followed by new line. <number> could be only positive integer and <name> could be any name. This will be used only if an error occurs in the script. The error will contain the line:
`File <filename>, line <linenumber>`

where <filename> will be the <name> you set and <linenumber> will be <number> + how many lines it is from the **#line** line. If the error happened on the line right under **#line** it will add 0 to <number>, if on second line, it will add 1 etc.

It is possible to use more than one **#line** keywords, but it seems having just one at the top for little script is enough to pinpoint position of the error easily.

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

## Syntax

```sqf
preprocessFileLineNumbers fileName
```

**Parameters:**

- `fileName`: [String](../topics/String.md) - path to the file

**Returns:** [String](../topics/String.md) - file content containing `1. line 1 "aFilename"`

## Examples

### Example 1

```sqf
_string = preprocessFileLineNumbers "A3\ui_f\scripts\IGUI\RscUnitInfo.sqf"
```

Result is:

 #line 1 "A3\ui_f\scripts\IGUI\RscUnitInfo.sqf"

 disableserialization;

 ........

## See also

[fileExists](../commands/fileExists.md) · [preprocessFile](../commands/preprocessFile.md) · [loadFile](../commands/loadFile.md) · Function · [SQF Syntax](../topics/SQF_Syntax.md) · [call](../commands/call.md) · [spawn](../commands/spawn.md) · [execVM](../commands/execVM.md) · [PreProcessor Commands](../topics/PreProcessor_Commands.md)

## Community notes

**Killzone_Kid** — 2013-12-17

The main difference between [preprocessFile](../commands/preprocessFile.md) and [preprocessFileLineNumbers](../commands/preprocessFileLineNumbers.md) is that the latter adds #line keyword to the target file, which allows to log the __LINE__ error happened at and the __FILE__ error happened in.

---

**code34** — 2017-11-04

The #line directive get's removed from the output.

So to add a custom #line directive before while using preprocessFileLineNumbers, you have to use a preprocessor macro like this:

*#define* DEBUG(sharp,name) sharp##line 0 name

and add this at the right place in your code

DEBUG(#,"your filename");

This way you can have custom filenames in error messages.

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