The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
Reads text from an InStream object.
[Read := ] InStream.ReadText(Text[, Length])
The variable that receives the characters that were read.
The number of characters to be read. If you do not specify this parameter, the maximum length of the string is used.
Property Value/Return Value
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 method. This example requires that you create the following variables.
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();