InStream.EOS Function

Indicates whether an input stream has reached End of Stream (EOS).

IsEOS := InStream.EOS

Property Value/Return Value

Type: Boolean

Yes if the stream has reached End of Stream; otherwise, No.

Remarks

If you are reading data from an external component, EOS can return FALSE even though no more data is available. This may occur if you have not called READ first.

Example

The following example opens the text file in a folder that is named MyFolder. The data in the text file is read into and input stream variable named StreamInTest. The InStream.EOS Function is used to determine whether the input stream has reached the end. If the stream has not reached the end, the stream is read into a text buffer, which indicates that the stream has not reached the end until the stream reaches the end. This example requires that you create the following variables in the C/AL Globals window. You must also create the following file 'c:\MyFolder\MyText.txt'.

Variable name DataType

FileTest

File

StreamInTest

InStream

Buffer

Text

FileTest.OPEN('c:\MyFolder\MyText.txt');
FileTest.CREATEINSTREAM(StreamInTest);
WHILE NOT StreamInTest.EOS DO BEGIN
  StreamInTest.READTEXT(Buffer);
  //Do some processing
  MESSAGE('Stream is still processing')
END;
MESSAGE('End of Stream');

See Also

Reference

InStream.READ Function
InStream.READTEXT Function
InStream and OutStream Data Types