FileSystem.FileClose(Int32[]) Método
Definição
Conclui a E/S (Entrada/Saída) para um arquivo aberto usando a função FileOpen.Concludes input/output (I/O) to a file opened using the FileOpen function. My oferece maior produtividade e desempenho em operações de E/S de arquivo.My gives you better productivity and performance in file I/O operations. Consulte FileSystem para obter mais informações.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())
Parâmetros
- FileNumbers
- Int32[]
Opcional.Optional. Matriz de parâmetros de 0 ou mais canais que serão fechados.Parameter array of 0 or more channels to be closed.
Exceções
FileNumber não existe.FileNumber does not exist.
Exemplos
Este exemplo usa a FileClose função para fechar um arquivo aberto para Input .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.
Comentários
A FileClose função é fornecida para compatibilidade com versões anteriores e pode afetar o desempenho.The FileClose function is provided for backward compatibility and may affect performance. Para aplicativos não herdados, o My.Computer.FileSystem objeto fornece melhor desempenho.For non-legacy applications, the My.Computer.FileSystem object provides better performance. Para obter mais informações, consulte como: ler texto de arquivos com um StreamReader, como escrever texto em arquivos com um StreamWritere passo a passos: manipulando arquivos e diretórios em Visual Basic.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.
Se você omitir FileNumbers , todos os arquivos ativos abertos pela FileOpen função serão fechados.If you omit FileNumbers, all active files opened by the FileOpen function are closed.
Quando você fecha arquivos que foram abertos para Output Append o ou, o buffer final da saída é gravado no buffer do sistema operacional para esse arquivo.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. Todo o espaço do buffer associado ao arquivo fechado é liberado.All buffer space associated with the closed file is released.
Quando a FileClose função é executada, a associação de um arquivo com seu número de arquivo termina.When the FileClose function is executed, the association of a file with its file number ends.