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

</div>

Property

# TextOutputStream.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. Error numbers are given as original file system error codes.

## Sample code

This example reports the last error code if the TextOutputStream is `Nil</api/language/nil>`.

``` xojo
Dim t As TextOutputStream
Dim f As FolderItem
 = GetSaveFolderItem(FileTypes1.Text, "TestFile.txt")
f f Is Nil Then Return

Try
  t = TextOutputStream.Create(f)
  If t <> Nil Then
    t.WriteLine(TextArea1.Text)
    t.Close
  End If
Catch e As IOException
  MsgBox("Error Code: " + Str(t.LastErrorCode))
End Try
```

## Compatibility

All project types on all supported operating systems.
