CFile:Close
The Close method closes the file and frees operating system connections to it. The CFile object is not deleted and may be used to Open another file.
bResult = CFile:Close() |
On success, this method returns true.
On failure, this method returns false.
When the script is finished with the file, it should closed using Close or the delete destructor. The delete method sets the CFile object to nil, whereas closing the file leaves the CFile object available for continued use.
Typically you use new to create a CFile object, then use Open and Close to work with it and then clean up afterwards, before eventually calling delete to remove the CFile object.
Suppose a file exists with a full path named sPath. The script below shows the file being opened for reading and writing and then closed:
|
-- create a CFile object |
|
-- access mode: open for reading and writing |
|
-- open the file |
|
-- if not opened, then... |
|
-- leave the script, etc. |
|
|
|
-- do some operations... |
|
-- close the file |
|
-- if not opening another file, delete the object. |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.