CLOSE statement

Purpose

Conclude I/O (input/output) to / from a file or device.

Syntax

CLOSE [[#] filenum& [, [#] filenum&] ...]

Remarks

CLOSE ends the relationship between a PowerBASIC file number and the disk file or device that was associated with it by an OPEN statement.  Any pending I/O operations on the file/device are concluded, buffers are flushed and released, and the disk directory information (if any) for that file is updated.

If no file number is specified, CLOSE closes all open files.

If the file was opened using OPEN HANDLE, the CLOSE statement is still needed, although it does not tell the operating system to close the file.  In this special case, the file was already open when OPEN HANDLE provided access to it, and will remain open after CLOSE disassociates the file from PowerBASIC.

CLOSE works with all types of files and devices (disk files, devices, COMM, TCP, UDP, etc).

The number symbols (#) are optional but recommended for clarity.

See also

COMM CLOSE, FILEATTR, FLUSH, OPEN, TCP CLOSE, UDP CLOSE