Writes a line to a file.
Category: | External File |
Returned data type: | Integer |
Note: | The returned value is a Boolean value where 1= success and 0 = error. |
fileobject.WRITELINE(<string>)
string
a string specifying the information that needs to be written to the file. This parameter can be specified as a fixed string, field name, or expression
The writeline() method writes the string at the current position in the file. This method overwrites data that exists at the current position in the file. If the current position in the file plus the length of the string is larger than the current file size, then the file size is increased.
The file needs to be opened in Write or Append mode for this method to work.
file f
f.open("C:\filename.txt", "a")
f.writeline("This text will be appended to the file")
f.seekbegin(0)
f.writeline("Using seekbegin(0) and Append will still cause the info to be written at the start of the file")
f.close()