Hitachi

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


8.5.8 TextSeek (move the read/write position to the file beginning or end)

Purpose

Moves the read/write position in a text file to the beginning or end of the file.

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

Syntax
TextSeek (FileId [, Point])
Arguments
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. Specify a value other than WriteOnly as the file access mode in the TextOpen command.

Point

Specify the read/write position as either of the following values:

Value

Meaning

ToBegin

Move to the beginning of the file.

ToEnd

Move to the end of the file.

This value is optional. If you omit this value, ToBegin is assumed.

Description

The TextSeek command moves the read/write position to the specified position in the text file specified by file ID. The command returns True on successful execution, or False if an error occurs.

Example
' Write "** END OF FILE **" at the end of the text file
' "Loging.txt" in the execution folder.
Dim file1
file1 = TextOpen (_BIN_+"Loging.txt", ReadWrite)
If file1 = 0 Then
  MessageBox (_BIN_+"Failed to open Loging.txt", OK)
Else
  If TextSeek (file1, ToEnd) Then
    TextWrite (file1, "** END OF FILE **", False)
  End
  TextClose (file1)
End
JP1/Script version

Supported from JP1/Script 05-00.