Append a line of text to the end of a previously opened text file.
FileWriteLine ( filehandle or "filename", "line" )
Parameters
filehandle | The handle of a file, as returned by a previous call to FileOpen. Alternatively, you may use a string filename as the first parameter. |
line | The line of text to write to the text file. If the line does NOT end in @CR or @LF then a DOS linefeed (@CRLF) will be automatically added. |
Return Value
Success: | Returns 1. |
Failure: | Returns 0 if file not opened in writemode, file is read only, or file cannot otherwise be written to. |
Remarks
The text file must be opened in write mode or the FileWriteLine command will fail.
Related
FileClose, FileOpen, FileRead, FileReadLine, FileWrite
Example
$file = FileOpen("test.txt", 1)
; Check if file opened for writing OK
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
FileWriteLine($file, "Line1")
FileWriteLine($file, "Line2" & @CRLF)
FileWriteLine($file, "Line3")
FileClose($file)