# Text File Write

The **TextFileWrite** function will save some content to a text file.

***

## Properties

### File path

The full path to the file you wish to write to (i.e., `c:\temp\filename.txt`).

You can also set this property to the FileHandle of a [FileOpen ](https://docs.linx.software/reference/plugins/file/content/fileopen)function when its 'Is text' option is checked.

### Contents

The text to be written to the file.

You can enter some text directly into this property, or you can reference a string type or anything else from your function that can be converted to a string.

### Destination encoding

The encoding type to use when writing to the file.

Options:

* **Default**
* **ANSI**
* **ASCII**
* **EBCDIC**
* **Mac**
* **OEM**
* **Unicode**
* **UTF8**

The 'Default' option is the encoding used in your operating system.

### File does not exist

Specify what to do if the output file does not exist.

Options:

* **Create file**
* **Throw exception**

### File exists

What to do if the file already exists:

* **Append data**: will find the end of the file and add the data there.
* **Increment file name**: will add a number to the filename to make that name unique. This is a sequential number starting with 1.
* **Overwrite file**: will replace all content in the file with the new content.
* **Throw exception**: will stop the function's processing and return an error.

## Definition

**TextFileWrite** contains the file path of the file that has been written to.

***

## Links

[Wikipedia: Code page](http://en.wikipedia.org/wiki/Code_page)

[Joel on Character Sets](http://www.joelonsoftware.com/articles/Unicode.html)

[Go Global Developer Center: Code pages](https://docs.microsoft.com/en-us/globalization/encoding/transformations-of-unicode-code-points)
