AutoIt FileClose Function
Files that are opened with FileOpen can be closed using the FileClose function.
Edited: 2017-03-26 15:13
The AutoIt FileClose Function is used to close a file that has previously been opened using FileOpen, as well as search handles returned by FileFindFirstFile.
AutoIt automatically closes opened files when exiting, so using FileClose is likely only necessary under special circumstances. You can not use filenames when using FileClose – when using filenames rather than handles, with functions such as FileRead, the files will automatically be opened and closed.
Returns 1 on success, and 0 if the filehandle was invalid.
AutoIt FileClose Example
The below is an example that uses FileClose after opening a file, and writing a couple of lines to the file.
$file = FileOpen("SomeFile.txt", 1) FileWrite($file, "This is the first line written with AutoIt." & @CRLF) ; The CRLF at the end is a line break FileWrite($file, "Second line of the file.") FileClose($file)
Tell us what you think: