CFile:Open
The Open method opens a file and attaches it to the CFile object. Alternatively, you can use the global FileOpen function to open a file and create its CFile object in one operation.
bResult = CFile:Open( sPath, sAccessMode ) |
sPath is the full path specification of the file.
sAccessMode is a string specifying the file access.
On success, this method returns true.
On failure, this method returns false.
Usually, the CFile class would not be used to open images that are in formats supported by the CImage class, but it may be used to provide raw access to images.
This method can open the file in either text or binary mode for reading, writing, or appending. See CFile Access Modes.
When the script is finished with the file, it should closed using Close or the delete destructor. The latter method sets the CFile object to nil, whereas Closing the file leaves the CFile object available for continued use.
Suppose a text file exists with name sPath. This script opens it and lists its name it it was successfully opened. The name is listed using, at most, 60 characters:
|
-- create a CFile object |
|
-- use Open dialog to get a file |
|
-- open the file in append/text mode |
|
-- if not opened, then... |
|
-- leave the script, etc. |
|
|
|
-- write the path into the file |
|
-- close the file when done |
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.