WriteLine

Writes a line of text to a text file.

Syntax

WriteLine(fileID, lineString)

Parameters

Parameter

Type

Description

fileID

number

File ID received from OpenFile function

lineString

string

The string to be written to the file.

Return

None.

Note

In Python, use file object write() method. See Python code below.

Examples

Python

# open a file in write mode
file = open("C:\\Data\\results.txt", "w")
file.write("first line\n")
file.write("second line\n")
file.close()

NexScript

% open a file in write mode
fileID = OpenFile("C:\Data\results.txt", "w")
WriteLine(fileID, "first line")
CloseFile(fileID)