---
title: "printInFile"
canonical: "https://support.appfire.com/space/PSJ/15489159/printInFile"
format: markdown
---
> Macro (aura-html)


|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | printInFile(filepath, var [, charset [, hasNewLine]]) | **Package** | file |
| **Alias** |  | **Pkg Usage** | print(filepath, var [, charset [, hasNewLine]]) |

## Description

> Macro (excerpt)
> 
> Prints the provided value in the specified file.

Prints the provided value in the specified file. It appends the value to the file. For best results, use absolute paths, because relative paths are resolved starting with the current working directory.

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| filepath | String | Yes | Specifies the file name to write in. |
| var | String | Yes | Specifies the character expression to write into the file **filepath**. |
| charset | String | No | Specifies the **charset** used to write that file. Available starting with katl-commons 4.0.0. |
| hasNewLine | Boolean | No | It is used after **charset**. If set to **true**, it adds a new line after the value. If set to **false**, it doesn’t add any line. The default value is **true**. |

## Return Type

**None**

The returned value has no meaning.

## Example

```
printInFile("C:/story.txt", "Once upon a time...");
```

Prints the record **Once upon a time...** to the** story.txt **file.

> ⚠️ It is recommended that you use forward slashes ( / ) for file paths. As a general observation use the silEnv() function to create an absolute path.

## Example 2

```
printInFile("C:/story.txt", "Once upon a time...", "utf-8");
```

## Example 3

```
printInFile("C:/story.txt", "Once upon a time...", "utf-8", false);
```

## See also

> Macro (contentbylabel)