FileSystem.FileClose(Int32[]) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Concludes input/output (I/O) to a file opened using the FileOpen
function. My
gives you better productivity and performance in file I/O operations. See FileSystem for more information.
public:
static void FileClose(... cli::array <int> ^ FileNumbers);
public static void FileClose (params int[] FileNumbers);
static member FileClose : int[] -> unit
Public Sub FileClose (ParamArray FileNumbers As Integer())
- FileNumbers
- Int32[]
Optional. Parameter array of 0 or more channels to be closed.
FileNumber
does not exist.
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.
MsgBox(TextLine) ' Display the line
Loop
FileClose(1) ' Close file.
The FileClose
function is provided for backward compatibility and may affect performance. For non-legacy applications, the My.Computer.FileSystem
object provides better performance. For more information, see How to: Read Text from Files with a StreamReader, How to: Write Text to Files with a StreamWriter, and Walkthrough: Manipulating Files and Directories in Visual Basic.
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.
Προϊόν | Εκδόσεις |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET σχόλια
.NET είναι ένα έργο ανοιχτού κώδικα. Επιλέξτε μια σύνδεση για να παρέχετε σχόλια: