Close file

Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO Windows,Linux


Close file (refnumReturns err-code


Note: The flag is set according to whether Omnis was able to make a call to this external command.

This command closes a file previously opened by the Open file command. You specify the file reference number returned by Open file in refnum. You should call Close file for each files you open with Open file, when you have finished using the file.

It returns an error code (See Error Codes), or zero if no error occurs.


; read a text file then close it

Calculate lPathname as con(sys(115),'html',sys(9),'serverusagetask.htm')
Open file (lPathname,lRefNum) Returns lErrCode ;; opens the file
Read file as character (lRefNum,lFile) Returns lErrCode ;; reads the file contents into lFile
Close file (lRefNum) Returns lErrCode ;; now close the file