FileClose

Description

Closes the file associated with the specified file number. The file number was assigned to the file with the FileOpen function.

Syntax

FileClose ( file# )

Argument

Description

file#

The integer assigned to the file you want to close. The FileOpen function returns the file number when it opens the file.

Returns

Integer. Returns 1 if it succeeds and -1 if an error occurs. If file# is null, FileClose returns null.

Examples

Example 1

These statements open and then close the file EMPLOYEE.DAT. The variable li_FileNum stores the number assigned to the file when FileOpen opens the file. FileClose uses that number to close the file:

integer li_FileNum

li_FileNum = FileOpen("EMPLOYEE.DAT")

. . . // Some processing

FileClose(li_FileNum)

See also