Navigation: ABC Library Reference > FileManager > FileManager Methods >====== Open (open the file) ====== | |
Open, VIRTUAL, PROC
The Open method tells the FileManager the calling procedure is using the file, then OPENs the file if it is not already open. The Open method handles any errors that occur while opening the file, including creating the file and rebuilding keys if necessary.
The TryOpen method provides slightly different (manual) alternative for opening files.
Implementation:
If the file does not exist and the Create property is not zero, Open tries to create the file. If Open succeeds, it returns Level:Benign (declared in ABERROR.INC). If it ultimately fails, it returns the severity level of the last error it encountered while trying to open the file. See Error Class for more information on severity levels.
Return Data Type: BYTE
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager) !derive Access:Client object
Init PROCEDURE !prototype Access:File init
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
!file declaration
END
CODE
GlobalErrors.Init !initialize GlobalErrors object
Access:Client.Init !initialize Access:Client object
Access:Client.Open !open the Client file
!program code
Access:Client.Close !close the Client file
Access:Client.Kill !shut down the Access:Client object
GlobalErrors.Kill !shut down the GlobalErrors object