Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.5.5 TextClose (close a text file)

Purpose

Closes a text file.

In JP1/Script 07-50 or later, the command supports large files.

Syntax
TextClose ([FileId])
Argument
FileId

Specify the file ID as a number or as a variable that stores this value.

This file ID is the execution result returned by the TextOpen command.

This value is optional. When the argument is omitted or is 0, the command closes all open files.

Description

The TextClose command closes the text file specified by file ID. The command returns True on successful execution, or False if an error occurs.

Example
' Read Loging.txt, and write its contents to Backup.txt.
Dim file1, file2
file1 = TextOpen (_BIN_+"Loging.txt", ReadOnly)
If file1 = 0 Then
  MessageBox (_BIN_+"Failed to open Loging.txt", OK)
  Exit
End
file2 = TextOpen (_TEMP_+"Backup.txt", Create)
If file2 = 0 Then
  MessageBox ("Unable to open" _TEMP_+"Backup.txt.", OK)
  TextClose (file1)
  Exit
End
 
Dim buff1
If TextRead (file1, buff1) Then
  TextWrite (file2, buff1)
End
TextClose (file1)
TextClose (file2)
JP1/Script version

Supported from JP1/Script 05-00.