Close file

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

Syntax

Close file (refnumReturns err-code

Description

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.

Example

# read a text file then close it

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