Append a text/data to the end of a previously opened file.
FileWrite ( "filehandle/filename", "text/data" )
Parameters
| filehandle/filename | The handle of a file, as returned by a previous call to FileOpen. Alternatively, you may use a string filename as the first parameter. |
| text/data | The text/data to write to the file. The text is written as is - no @CR or @LF characters are added. See remark for data type. |
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 file must be opened in write mode or the FileWrite command will fail.
Related
FileFlush, FileOpen, FileRead, FileReadLine, FileWriteLine, Binary, FileSetPos, FileGetPos
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
FileWrite($file, "Line1")
FileWrite($file, "Still Line1" & @CRLF)
FileWrite($file, "Line2")
FileClose($file)