From Xojo Documentation
| This item was deprecated in version 2019r2.
Please use Readable.EndOfFile as a replacement.
Returns True when the read reaches the end of the stream.
This code reads the rows and columns of data from a tab-delimited text file into a ListBox:
Dim textInput As TextInputStream
Dim rowFromFile, oneCell As String
f = GetOpenFolderItem("text/plain") // defined as a FileType
If f <> Nil Then
textInput = TextInputStream.Open(f)
textInput.Encoding = Encodings.UTF8
rowFromFile = textInput.ReadLine
If ListBox1.ColumnCount < CountFields(rowFromFile, Chr(9)) Then
ListBox1.ColumnCount = CountFields(rowFromFile, Chr(9))
ListBox1.AddRow(NthField(rowFromFile, Chr(9), 1))
For i As Integer =1 To CountFields(rowFromFile, Chr(9))
oneCell = NthField(rowFromFile, Chr(9), i)
ListBox1.Cell(ListBox1.ListCount - 1, i - 1) = oneCell
Loop Until textInput.EOF
This example reads each pair of bytes from a file and writes them in reverse order to a new file. The user chooses the source file using the Open-file dialog box and saves the new file using the Save as dialog box. The EOF property is used to terminate the Do loop.
If readFile <> Nil Then
Dim ReadStream As BinaryStream = BinaryStream.Open(readFile, False)
ReadStream.LittleEndian = True
Dim writeFile As FolderItem = GetSaveFolderItem("", "")
If writeFile <> Nil Then
Dim writeStream As BinaryStream = BinaryStream.Create(writeFile, True)
writeStream.LittleEndian = True
Do Until ReadStream.EOF
writeStream = Nil
readStream = Nil