InStream.READTEXT
Collapse the table of content
Expand the table of content

InStream.READTEXT Function

Reads text from an InStream object.


[Read := ] InStream.ReadText(Text[, Length])

Parameters

Text

Type: Text

The variable that receives the characters that were read

Length

Type: Integer

The number of characters to be read. If you do not specify this parameter, the maximum length of the string is used.

Type: Integer

The number of characters that were read.

READTEXT reads the specified number of bytes, the maximum length of the string, or until the end of the line.

Data is read in text format.

If you do not use the optional return value and the data being read is less than the length requested to be read, an error message is displayed.

If you use the return value, you must verify the validity of the data that has been read.

This example shows how to use the InStream.READTEXT function. This example requires that you create the following variables.

Variable name DataType

FileTest

File

StreamInTest

InStream

Int

Integer

Txt

Text

FileTest.OPEN('c:\XMLDocs\NewTest.txt');
FileTest.CREATEINSTREAM(StreamInTest);
// Starting a loop
WHILE NOT (StreamInTest.EOS) DO BEGIN
  Int := StreamInTest.READTEXT(Txt,100);
  MESSAGE(Txt + '\Size: ' + FORMAT(Int));
END;
FileTest.CLOSE();

Community Additions

ADD
Show:
© 2016 Microsoft