Share this page

# IO.write

Writes the string to the specified file. If the file does not exist, it is created.

    IO.write(fileName, fileContent, append, charset);

## Arguments

Name | Description
--- | ---
filename | (string) The absolute path of the file.
fileContent | (string) String to write to the file.
append(Optional) | (boolean) Indicates whether to append the string or overwrite the existing file contents: true. Append the string to the end of the file (default). false. Overwrite the file with the string.
charset(Optional) | (string) The charset of the file, if it is not UTF-8. Supported charsets: ['binary', 'UTF-8', 'UTF-16', 'base64', 'ANSI']

## Return value

true upon success.

## Example

Copy code

    IO.write(TC.scriptDir + "mylog.txt", "first msg\n", false);
    IO.write(TC.scriptDir + "mylog.txt", "second msg");

The result content in the mylog.txt file:

`first msg`

`second msg`

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: