FileClose Procedure |
Microsoft.VisualBasic.FileSystem
FileClose([ filenumber ][, filenumber ][,...])
The file number (or numbers ) of an open file (or files), opened using the FileOpen procedure
Closes one or more files opened with the FileOpen procedure
If filenumber is omitted, all open files are closed.
If the file you are closing was opened for Output or Append , the remaining data in the I/O buffer is written to the file. The memory buffer is then reclaimed.
When the FileClose procedure is executed, the file number used is freed for further use.
filenumber can either be a literal number, a numeric constant, or a numeric variable.
With the FileClose procedure, you can close more than one file at once by specifying the file numbers as a comma-delimited list, as shown here:
FileClose(1, 3, 4)
The FileClose procedure does not check first to see if there is a file associated with the given file number. Therefore, no error occurs if you use the FileClose procedure with a nonexistent file number. The drawback to this is that you may inadvertently think you have closed a file, when in fact you haven't.
FileClose is new to VB.NET. It replaces the Close statement in VB 6.
FileOpen Procedure, Reset Procedure