<div class="meta" robots="noindex">

</div>

Property

# TextInputStream.LastErrorCode

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `IOException</api/exceptions/ioexception>` as a replacement.

</div>

## Description

Reports the last file I/O error.

## Notes

Error numbers are given as original file system error codes.

## Sample code

This example reports the last error code if the method could not open the file.

``` xojo
Dim f As FolderItem = SpecialFolder.Documents.Child("test.txt")
Dim t As TextInputStream

If f <> Nil And f.Exists Then
  t = TextInputStream.Open(f)
  ' make sure we could open it
  If t <> Nil Then
    ' Read all of t into myEditField.text
    myTextArea.Text = t.ReadAll
    ' close the file so that other applications can use it
    t.Close
  Else
    ' the file could not be a read as a text file
    MsgBox("The selected file is not a text file. Error: " + Str(t.LastErrorCode))
  End If
End If
```

## Compatibility

All project types on all supported operating systems.
