Close Statement
Closes a file that has been opened with AOpen, BOpen, ROpen, UOpen, or WOpen.
Syntax
Close #fileNumber
Parameters
- fileNumber
- Specify an integer value from 30 to 63 or an expression.
Description
Closes the file referenced by file handle fileNumber and releases it.
See Also
AOpen Statement, BOpen Statement, Flush Statement, FreeFile Function, Input #, Print #, ROpen Statement, UOpen Statement, WOpen Statement
Close Statement Example
This example opens a file, writes some data to it, then later opens the same file and reads the data into an array variable.
Integer fileNumber, i, j
fileNumber = FreeFile
WOpen "TEST.DAT" As #fileNum
For i = 0 To 100
Print #fileNum, i
Next i
Close #fileNum
FileNum = FreeFile
ROpen "TEST.DAT" As #fileNum
For i = 0 to 100
Input #fileNum, j
Print j
Next i
Close #fileNum