Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

FileClose Function

Concludes input/output (I/O) to a file opened using the FileOpen function.

Public Sub FileClose(ParamArray FileNumbers() As Integer)

Parameter

FileNumbers()
Optional. Parameter array of 0 or more channels to be closed.

Exceptions/Errors

Exception type Error number Condition
IOException 52 FileNumber does not exist.

Remarks

If you omit FileNumbers(), all active files opened by the FileOpen function are closed.

When you close files that were opened for Output or Append, the final buffer of output is written to the operating system buffer for that file. All buffer space associated with the closed file is released.

When the FileClose function is executed, the association of a file with its file number ends.

Example

This example uses the FileClose function to close a file opened for Input.

Dim TextLine As String
FileOpen(1, "TESTFILE", OpenMode.Input)   ' Open file.
Do While Not EOF(1)   ' Loop until end of file.
   TextLine = LineInput(1)   ' Read line into variable.
   Debug.WriteLine(TextLine)   ' Print to the Immediate window.
Loop
FileClose(1)   ' Close file.

Smart Device Developer Notes

This function is not supported.

Requirements

Namespace: Microsoft.VisualBasic

Module: FileSystem

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

End Statement | FileOpen Function | Reset Function | Stop Statement | File Access with Visual Basic Run-Time Functions| IOException Class

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.