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

</div>

Property

# BinaryStream.LastErrorCode

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

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `Exception Handling</getting_started/debugging/exception_handling>` as a replacement.

</div>

## Description

Reports the last file I/O error. Error numbers are given as original file system error codes.

## Notes

For BinaryStream objects created with a `String</api/data_types/string>`, all errors return 100. This happens if you try to write to or set the length of the BinaryStream.

## Sample code

This code gets the last error code. If there is no error code, <span class="title-ref">LastErrorCode</span> returns 0.

``` xojo
Dim i As Integer
Dim readStream As BinaryStream = BinaryStream.Open(readFile, False)
.
i = readStream.LastErrorCode
```

## Compatibility

All project types on all supported operating systems.
