System Services Methods

Methods used to work with text files.

This page discusses:

TextFile.Close()

Lets you close a text file.

Signature

TextFile.Close()

Example

let file (TextFile)
set file = OpenTextFile("e:\tmp\TextFile1.txt","w")
...
file->Close()

TextFile.IsEndOfFile()

Lets you know if end of file has been reached.

Signature

TextFile.IsEndOfFile() : Boolean

Arguments

Name Input / Output Required? Type Comment
Text File In Yes IsEndOfFile Text file must be read and write.

Example

let file (TextFile)
// To open a file in read mode: 
set file = OpenTextFile("f:\TextFile1.txt","r") 
//To get the data of the file in a buffer: 
let buffer (String) 
let i (Integer) 
for i while file->IsEndOfFile() <> TRUE 
{ 
//Read the file until end is reached, read function reads one line at a time 
set buffer = file->Read() 
}

TextFile.Read()

Lets you read a text file.

Signature

TextFile.Read(Format : String [, Parameters : ObjectType]) : String

Arguments

IsEndOfFile

Name
Input / OutputRequired?TypeComment
FormatInYesString
ParametersInNoObjectType

ReturnType

String

Example 1

let file (TextFile)
let buffer (String)
set file = OpenTextFile("e:\tmp\TextFile1.txt","r")
set buffer = file->Read()

Example 2

let parms (List)
parms.Append(' Representation316411704 --- IN_WORK\Integer.1' )
parms.Append(' Representation316411704 --- IN_WORK\Real.1' )
parms.Append(' Representation316411704 --- IN_WORK\Length.1' )
set file = OpenTextFile("e:\tmp\TextFile1.txt","w")
format = "Integer = # Real = # Length = #" 
buffer  = file->Read(format,parms)

The result is the following:
buffer = "Integer = 5 Real = 10.23 Length = 22mm"
The function also modifies the parameters depending on the text file content. If no parameter exists (ex: Integer.1), it is not created and a warning message appears.

TextFile.Write()

Lets you write in a text file.

Signature

TextFile.Write(String [, Parameters : ObjectType])

Arguments

NameInput / OutputRequired?TypeComment
InYesString-
ParametersInNoObjectType-